b85*_*411 0 android listview hard-coding
是否可以在Android中执行此类操作?(基本上相当于select和optionHTML):
<ListView android:layout_height="match_parent"
android:layout_width="match_parent">
<ListViewItem>TEST</ListViewItem>
<ListViewItem>TEST1</ListViewItem>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我试过这个,显然不起作用.我在网上找到的只是有关使用适配器的信息,但由于我有一些硬编码值,我不需要使用适配器 - 我很乐意将它直接放在XML文件中.
这可能吗?
1]在strings.xml中创建一个String数组
2]在Listview标签内使用以下属性android:entries ="@ array/your_array_name"
做完了!
| 归档时间: |
|
| 查看次数: |
2494 次 |
| 最近记录: |