2011-03-16 160 views
2

我有一个ListActivity,它使用以下xml为每个项目填充列表视图。RelativeLayout - TextView不显示

任何人都可以请告诉我为什么第三行的时间窗口的名称不显示?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" android:layout_height="100dip" 
android:padding="6dip" android:id="@+id/result_item" android:background="#000000"> 

<TextView android:id="@+id/rule" android:layout_marginLeft="55dip" 
    android:layout_width="fill_parent" android:layout_height="26dip" 
    android:layout_toRightOf="@+id/imgview" android:textAppearance="?android:attr/textAppearanceMedium" 
    android:gravity="bottom" android:text="Rule....." /> 

<TextView android:id="@+id/accuracy" android:layout_width="fill_parent" 
    android:layout_height="26dip" android:layout_below="@+id/rule" 
    android:layout_alignLeft="@id/rule" android:layout_alignParentBottom="true" 
    android:gravity="top" android:text="Accuracy" /> 

<TextView android:id="@+id/time_window" android:layout_width="fill_parent" 
    android:layout_height="26dip" android:layout_below="@+id/accuracy" 
    android:layout_alignLeft="@id/rule" android:layout_alignParentBottom="true" 
    android:gravity="top" android:text="time window..." /> 

<ImageView android:id="@+id/imgmine" android:layout_width="38px" 
    android:layout_height="38px" android:layout_gravity="center_vertical" 
    android:src="@drawable/mine" /> 
     </RelativeLayout> 

回答

4

第二个视图是取所有的高度空间:android:layout_alignParentBottom="true"。删除该语句,它将解决问题。

顺便说一下,强烈建议您也使用Android SDK中的hierarchyviewer。它允许您查看视图的构建方式并检测这种错误。

+0

so alignParentBottom只能用于最后一个视图?如果是这种情况,那么它解决了我的问题:-)干杯! – kkudi 2011-03-16 15:49:32