我是Android的新手,我想我正在尝试做一些非常基本的事情:我的数组中有5个字符串(比如'One','Two',.. )。我想将这5个字符串添加到我的listactivity中的列表视图中。Android:填充列表视图与数组项目
我的列表:
<ListView
android:id="@+id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
我的列表行:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/homeItemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
基本上,我要绑定的数组项的TextView的homeItemName。以后我可能会在我的行中添加其他项目,所以我不能将listview绑定到条目。
谢谢!
您需要Adapters和ArrayAdapters的基本知识。 您可能需要扩展其中的一个类。 – daliz 2010-03-07 00:43:44