`
shuai1234
  • 浏览: 936297 次
  • 性别: Icon_minigender_1
  • 来自: 山西
社区版块
存档分类
最新评论

修改ExpandableListView前面展开小图标

 
阅读更多
 
1、需要写一个selector的xml文件

 

[html] view plaincopy
 
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android">  
  3.     <item android:state_expanded="true" android:drawable="@drawable/select_button"></item>  
  4.     <item android:drawable="@drawable/select_button_down"></item>  
  5. </selector>  
这里state_expanded="true"指是展开状态的图片

 

然后再Activity中加入代码

 

[java] view plaincopy
 
  1. expLV = (ExpandableListView) mLayout.findViewById(R.id.ExpandableListView_Section);  
  2.         expLV.setGroupIndicator(this.getResources().getDrawable(R.drawable.group_icon_selector));  

注意这里面图片是会被拉伸的

 

所以需要制作成9.png格式的图片

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics