How can i nest listviews?
Code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ListView
android:id="@+id/places_listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText android:id="@+id/places_search_box"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:imeOptions="actionSearch"
android:singleLine="true"
android:hint="Search"/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ListView
android:id="@+id/places_listViewP开发者_运维知识库laces"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</ListView>
</LinearLayout>
</ListView>
</LinearLayout>
Where is here the error?
Thanks for help
You don't put items like that in a ListView. You are supposed to use a ListAdapter
You can't nest ListViews, instead implement only one ListView and see the following possibilities :
- add a header and/or a footer to your ListView.
- merge your data from different sources into the same adapter via a custom BaseAdapter.
精彩评论