0
ユーザーがクリックするとアイテムが展開されたり折りたたまれたりするAnimatedExpandableListViewがあります。 選択したアイテムを展開すると強調表示され、折りたたまれたときには元の状態に戻ります(強調表示されません)。AnimatedExpandableListView項目を選択できません
AnimatedExpandableListViewのXML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/list_selector"/>
そして、選択された状態リスナーの背景描画可能:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/blue_linear_layout" android:color="@color/white" android:state_selected="true"/>
<item android:drawable="@drawable/blue_linear_layout" android:color="@color/white" android:state_activated="true"/>
<item android:drawable="@drawable/gray_linear_layout" />
</selector>
背景私が選択したときに変更したいAnimatedExpandableListView項目の
<com.packagename.library.AnimatedExpandableListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:divider="@null"
android:dividerHeight="0dp"
android:choiceMode="singleChoice"/>
のLinearLayout
設定choiceMode=singleChoice
と通常のListViewの項目のバックグラウンドにlist_selector
ドロアブルを追加すると問題なく動作しますが、AnimatedExpandableListViewでは機能しないようです。
Hereは私のプロジェクトに使用しているAnimatedExpandableListViewクラスのgithubです。
ありがとうございます!