gpt4 book ai didi

android - 在 Android 中动态加载 ListView 时布局显示不正确?

转载 作者:搜寻专家 更新时间:2023-11-01 09:18:31 24 4
gpt4 key购买 nike

    <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>

这是我在适配器中扩充的布局。显示所有内容,但只有应该显示在底部的第二个 TextView 显示在顶部。有人可以告诉我这个问题吗?

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

最佳答案

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

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

关于android - 在 Android 中动态加载 ListView 时布局显示不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2689621/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com