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。
在此先感谢!