1、需要写一个selector的xml文件
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_expanded="true" android:drawable="@drawable/select_button"></item> <item android:drawable="@drawable/select_button_down"></item> </selector>这里state_expanded="true"指是展开状态的图片
然后再Activity中加入代码
expLV = (ExpandableListView) mLayout.findViewById(R.id.ExpandableListView_Section);
expLV.setGroupIndicator(this.getResources().getDrawable(R.drawable.group_icon_selector));
注意这里面图片是会被拉伸的
所以需要制作成9.png格式的图片
本文介绍如何为ExpandableListView设置不同状态下的图标显示,包括展开状态和默认状态的图片资源选择器配置方法及注意事项。
2146

被折叠的 条评论
为什么被折叠?



