0
我有一個AnimatedExpandableListView,當用戶點擊它時,項目展開和摺疊。 我希望所選項目在展開時突出顯示,並在摺疊時返回其原始狀態(非突出顯示)。AnimatedExpandableListView項目不可選
AnimatedExpandableListView的XML:
AnimatedExpandableListView的LinearLayout的<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
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>
設置choiceMode=singleChoice
並將list_selector
可繪製到常規ListView的項目背景工作正常,但它似乎不能在AnimatedExpandableListView上工作。
Here是我用於我的項目的AnimatedExpandableListView類的github。
在此先感謝!