2012-10-11 30 views
0

好吧我背後有一整週的挫折,這是佈局行爲隨機的第三次。Android隨機用戶界面行爲

例如:

<TextView 
    android:id="@+id/tvGebiedHead" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="18dp" 
    android:layout_marginTop="16dp" 
    android:text="Geef gebied op" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 


<ListView 
    android:id="@+id/lvGebieden" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_alignLeft="@+id/textView1" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/textView1" > 

</ListView> 

產生在顯示列表視圖上的TextView的頂部(使兩個項目不可讀)的結果。這裏的代碼產生所需的結果,listview在textview下呈現。它不是eclipse圖形編輯器,但它也發生在真實的手機上。請注意,兩個片段之間唯一的區別是TextView的id。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/RelativeLayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="18dp" 
    android:layout_marginTop="16dp" 
    android:text="Geef gebied op" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 


<ListView 
    android:id="@+id/lvGebieden" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_alignLeft="@+id/textView1" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/textView1" > 

</ListView> 

本週早些時候,我曾與哪個(所有!!)改變大小的4周的ToggleButtons佈局的戰鬥,文字上的按鈕排列,甚至位置當我點擊一個,而上和文字完全一樣。請告訴我,我做錯了什麼,android並沒有壞掉。

回答

0

在上面的示例中,您的ListView的layout_below仍然指,它不存在。但是,在你的例子中,底部正在工作。僅供參考,@+id/textView1您應該在layout_below中使用@id\textView1

+0

謝謝。我在想我瘋了。 – Harmen