2011-04-27 80 views
0

我有以下布局。相对布局 - 一些问题

<TextView 
    android:id="@+id/item_text" 
    android:layout_margin="5dip" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:text="@string/item_text" 
    android:textColor="#787878" 
    android:layout_width="wrap_content" 
    android:textStyle="bold"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_internet" 
    android:text="@string/item_internet" 
    android:layout_below="@id/item_text" /> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_internet" 
    android:layout_alignTop="@id/item_internet" 
    android:id="@+id/internetImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_overnightStay" 
    android:text="@string/item_overnightStay" 
    android:layout_below="@id/item_internet"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_overnightStay" 
    android:layout_alignTop="@id/item_overnightStay" 
    android:id="@+id/overnightStayImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_wasteDisposal" 
    android:text="@string/item_wasteDisposal" 
    android:layout_below="@id/item_overnightStay" /> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_wasteDisposal" 
    android:layout_alignTop="@id/item_wasteDisposal" 
    android:id="@+id/wasteDisposalImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_toilet" 
    android:text="@string/item_toilet" 
    android:layout_below="@id/item_wasteDisposal" /> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_toilet" 
    android:layout_alignTop="@id/item_toilet" 
    android:id="@+id/toiletImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_electricity" 
    android:text="@string/item_electricity" 
    android:layout_below="@id/item_toilet"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_electricity" 
    android:layout_alignTop="@id/item_electricity" 
    android:id="@+id/electricityImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_cran" 
    android:text="@string/item_cran" 
    android:layout_below="@id/item_electricity"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_cran" 
    android:layout_alignTop="@id/item_cran" 
    android:id="@+id/cranImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_slipway" 
    android:text="@string/item_slipway" 
    android:layout_below="@id/item_cran"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_slipway" 
    android:layout_alignTop="@id/item_slipway" 
    android:id="@+id/slipwayImage"/> 

<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_camping" 
    android:text="@string/item_camping" 
    android:layout_below="@id/item_slipway"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_camping" 
    android:layout_alignTop="@id/item_camping" 
    android:id="@+id/campingImage"/> 


<TextView 
    style="@style/CodeFont" 
    android:id="@+id/item_freshWater" 
    android:text="@string/item_freshWater" 
    android:layout_below="@id/item_camping"/> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_toRightOf="@id/item_freshWater" 
    android:layout_alignTop="@id/item_freshWater" 
    android:id="@+id/freshWaterImage"/> 


<ListView 
    android:layout_width="fill_parent" 
    android:layout_below="@+id/item_freshWater" 
    android:layout_height="fill_parent" 
    android:id="@+id/android:list" 
    android:layout_weight="0.5"/> 

我生成用于动态列表视图中的详细信息,以便它可以是不同的尺寸。目前有一半以上的屏幕被textViews和imageViews占用。这为listView留下了第三个左边,所以它看起来不太好。是否也可以使用滚动视图,因此listview的高度可能会更大。我想一个方法来实现这将是重量,但我有这样做的问题。一如既往的赞赏。

回答

0

这是更好地在ListView中使用

android:scrollbars="vertical" 

使ListView中滚动。也可以通过去除使用

requestWindowFeature(Window.FEATURE_NO_TITLE); 

上述的setContentView()方法

+0

ListView中确实滚动标题栏创建更多的空间。但在屏幕的第三个屏幕上滚动并不是一个非常好的用户体验。这也是在3.7英寸的屏幕上。对于更小的东西来说这将是可怕的。 – jiduvah 2011-04-27 16:01:02