我知道,当您想要使用ListActivity时,它要求您在XML中将列表名称设置为"@android:id/list"。在这种情况下,如果我想使用两个listview,既然它有相同的id,我该如何实现?
带有'@android:id/list'
的listactivity表示屏幕中央的单个全屏列表。如果你想在你的活动中使用两个列表视图,你必须为它们使用不同的id。类似:
<LinearLayout android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ListView android:id="@+id/list1"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
</ListView>
<ListView android:id="@+id/list2"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
</ListView>
</LinearLayout>