[英]How to change ListView Item programmatically in Android?
I have a ListView and I want to change the listitem of it programmatically.我有一个 ListView,我想以编程方式更改它的列表项。 Is there any way to do this?
有没有办法做到这一点? Thank you in advance.
先感谢您。
This is my ListView XML code.这是我的 ListView XML 代码。
<ListView
android:id="@+id/foodsListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:stackFromBottom="false"
android:transcriptMode="disabled"
tools:listitem="@layout/item_food">
</ListView>
And here is what I want to show instead of item_food
:这是我想要展示的而不是
item_food
:
"R.layout.item_message"
Use RecyclerView instead of ListView.使用 RecyclerView 而不是 ListView。 It was create for this t
它是为这个 t 创建的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.