安卓:在XML创建的ListView? [英] Android: Create ListView in XML?
问题描述
我想创建一个列表视图设置的项目是不是真的要改变有限。
I want to create a list view with limited set of items that isn't really going to change.
每个行是要对右边的左边和文本的图像。 (就像在设置应用程序)
Each row is going to have an image on the left and text on the right. (Just like in the Settings app)
我可以填充,在XML(即避免写code)?
Can I populate that in XML (i.e. avoid writing code) ?
推荐答案
我找到了答案在这里:<一href="http://stackoverflow.com/questions/3220862/android-creating-listview-entirelly-from-xml">Android - 从XML entirelly创建列表视图
I found the answer here: Android - creating listview entirelly from xml
您可以使用安卓项
属性的的ListView
元素,指向一个&LT;字符串数组&GT;
资源(通常放在 RES /价值/ arrays.xml
)
"You can use the android:entries
attribute on your ListView
element, pointing to a <string-array>
resource (typically put in res/values/arrays.xml
)."
这篇关于安卓:在XML创建的ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!