My view look like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!--list 1-->
<ListView
android:id="@+id/lvMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent"
android:layout_marginBottom="10dp" />
<!--the header-->
<LinearLayout
android:id="@+id/llIndustries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/dark_grey_title_bar"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingTop="5dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/industry_clusters"
android:textSize="16sp"/>
</LinearLayout>
<!--list 2-->
<ListView
android:id="@+id/lvIndustries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="@android:color/transparent" />
</LinearLayout>
I use two custom adapter to display two list view (the listview data source completely different each other):
private List<MenuInfo> menuData;
private List<MenuInfo> industriesData;
lvMenu = (ListView) layoutRoot.findViewById(R.id.lvMenu);
lvIndustries = (ListView) layoutRoot.findViewById(R.id.lvIndustries);
menuAdapter = new MenuAdapter(getActivity(), menuData);
lvMenu.setAdapter(menuAdapter);
industriesAdapter = new MenuAdapter(getActivity(), industriesData);
lvIndustries.setAdapter(industriesAdapter);
What I expect is:
<ListView/> <!-- listview 1-->
<TextView/> <!-- header-->
<ListView/> <!-- listview 2-->
But the problem is two list view auto merged into one ListView
, and the header TextView
disappear (If has one ListView
, the header will be showed).
I have no idea for this issue. Could you please tell me where I am wrong?