修改ExpandableListView中父Item的箭头图标
来源:互联网 发布:单片机电压测量电路 编辑:程序博客网 时间:2024/05/16 14:10
在Android系统中ExpandableListView的父Item项会有一个图标,用于指示当前是展开或闭合的状态.这个图标系统是有自带的. 自定父Item的layout时,并不能修改到它.要修改到它有个方法. 那就是自定义一个expandable_list_view_group_indicator.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/icon_expanded" />
<item android:drawable="@drawable/icon_up" />
</selector>
在编写xml文件时, 在eclipse 中并不能自动弹出 android:state_expanded 这个属性值. 这点需要注意.
然后在用到 ExpandableListView 的xml 文件中对它的 android:groupIndicator 进行设置, 代码如下:
..................................
<ExpandableListView
android:id="@+id/expandabel_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
........................................................
android:groupIndicator="@drawable/expandable_list_group_indicator_icon" />
这样就可以显示自定义的图标.
当然也可以使用java代码的实现方式. 代码如下:
ExpandableListView myExpandableListView;
myExpandableListView = (ExpandableListView)findById(R.id.expandabel_list_view);
myExpandableListView.setGroupIndicator(this.getResources().getDrawable(R.drawbale.expandable_list_group_indicator_icon));
- 修改ExpandableListView中父Item的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- Android中替换ExpandableListView控件前面的箭头图标
- Android中替换ExpandableListView控件前面的箭头图标
- Android中替换ExpandableListView控件前面的箭头图标
- 如何修改ExpandableListView中GroupView的箭头指示标志
- 去掉或自定义ExpandableListView的箭头图标
- Android—去掉ExpandableListView的箭头图标
- ExpandableListView替换系统箭头图标
- 去掉ExpandableListView的系统自带的箭头图标
- ExpandableListView(二)替换箭头图标被拉伸的问题
- ExpandableListView(二)替换箭头图标被拉伸的问题
- ExpandableListView 功能界面布局探究之一 ( 更换ExpandableListView右边的箭头(小图标))
- AJAX 缓存问题的两种解决方法(IE)
- C/C++模块化编译Lu脚本函数
- 关于QComboBox你不知道的那些事!
- Avro简介
- RGB颜色搭配方法
- 修改ExpandableListView中父Item的箭头图标
- NYOJ 16 矩形嵌套
- 使用apktool反编译apk文件的资源信息
- Effective C++ ----以对象管理资源
- 对Lu模块进行加锁
- 回收站内被清空的数据还可以找回来
- 积累
- JNI调用C方法
- JBoss 系列七十一:jBPM 6 发布,快速安装,新功能介绍