2011-04-27 36 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