我正在其含有ExpandableListView
,一個CheckedTextView
和ListView
定製視圖:如何將多個UI元素合併到android中的listview中?
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/filtersDialogView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="200dp"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/filtersListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<CheckedTextView
android:id="@+id/onlyShowAvailableItemsCheckedTextView"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center_vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip"
android:text="@string/OnlyShowAvailableItems" />
<ListView
android:id="@+id/categoriesListView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
的問題是,所述CheckTextView
是固定的,這兩個列表獨立地滾動(這是正常的該佈局) 。此外,當我從ExpandableListView
展開一個列表項時,CheckedTextView
和其他ListView
隱藏。當我展開第一個列表的一個元素(第二個列表的單元格不能展開時)時,我想製作一個包含所有這些元素的單個列表,這些元素可以正確滾動和調整大小。我怎樣才能做到這一點?是否有可能無需修改CheckedTextView
的列表和控制器的適配器? 謝謝
相當真棒:) – Alexis
我想擺脫出現在不擴展的組視圖上的下拉圖標。我怎樣才能做到這一點? – Alexis
@jafar不幸的是,這是你必須自己做的事情之一。因爲你擁有所有帶有圖標的組或者所有組都沒有圖標,你必須管理自己的狀態。我修改了從我的答案鏈接的代碼再看看它(檢查'getGroupView'方法)。您基本上必須從所有組中刪除圖標,然後在擴展組的佈局文件中添加一個「ImageView」。畢竟,註冊一個'OnGroupClickListener'並根據當前狀態修改可繪製的圖像,摺疊/展開。 – Luksprog