我已使用此代碼在另一個頂部顯示2個列表視圖。<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical" ><ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#f00" ></ListView><ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#0f0" ></ListView>問題是,這導致2個列表視圖各自占據屏幕的一半。我將標題添加到兩個這樣的列表。LevelAdapter adapter = new LevelAdapter(getActivity(), R.layout.list_item, weather_data); View header = inflater.inflate(R.layout.header2, null); View header2 = inflater.inflate(R.layout.header, null); lv1.addHeaderView(header); lv2.addHeaderView(header2); lv1.setAdapter(adapter); lv2.setAdapter(adapter);我希望第二個列表的標題在第一個列表結束后出現。我該如何做?如何使列表視圖出現,從而使第二個視圖在第一個視圖結束時開始?謝謝
- 3 回答
- 0 關注
- 407 瀏覽
添加回答
舉報
0/150
提交
取消