2

    <TextView
        android:id = "@+id/txtBabbleListTitle"
    android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:textColor = "#000000"       
        android:text = "New Babble has been put up." >
    </TextView>

    <TextView
        android:id = "@+id/txtBabbleDateTime"
    android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:layout_alignParentBottom = "true"
    android:textColor = "#000000"    
    android:text = "2010-04-10 09:47:42" >
    </TextView>

    <TextView
        android:id = "@+id/txtBabbleTotalReplies"
        android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:layout_alignParentRight = "true"
    android:textColor = "#000000"       
        android:text = "(7)" >
   </TextView> 
</RelativeLayout>

这是我在适配器中膨胀的布局。一切都显示出来了,但只有应该显示在底部的第二个文本视图才会显示在顶部。有人可以让我知道这个问题吗?

II 在 Eclipse 的布局选项卡中查看它,然后它会正确显示。仅当动态获取文本时才会出现此问题。

4

1 回答 1

3

您没有说明您是如何“在适配器中膨胀”的。

如果您自己通过 a 执行此LayoutInflater操作,请务必使用inflate(R.layout.row, parent, false), whereR.layout.row是与您上面的 XML 匹配的布局资源,并且parentis ListView(传递到getView()or newView(),您正在执行通货膨胀的地方)。如果不使用此特定版本的inflate()方法,RelativeLayout将无法很好地用作行容器。

于 2010-04-22T10:47:09.377 回答