设置ExpandableListView右边的箭头
来源:互联网 发布:歼6无人机知乎 编辑:程序博客网 时间:2024/04/29 04:07
更换ExpandableListView右边的箭头(小图标)的疑问
第一个方法: 网上许多说到在ExpandableListView的布局xml中的groupIndicator更换成@drawable/***,我试过,可行,代码如下:
首先在drawable的文件夹下建立自定义选择布局属性的xml文件:ex_smallimage.xml
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_expanded="false"
android:drawingCacheQuality="auto"
android:drawable="@drawable/la"/> 这里la是下拉图标
<item android:state_expanded="true"
android:drawingCacheQuality="auto"
android:drawable="@drawable/shou"/> 这里shou是收回图标
</selector>
然后在ExpandableListView的groupIndicator设为:android:groupIndicator="@drawable/ex_smallimage"
这样做了可行,但是有个问题,就是图标总是随group的大小而拉伸,不会缩放:
那么我调了xml的group代码之后,可以勉强达到自己要求的效果,但是这样的代码没有弹性,换张图片还得改布局。。。如果有知道如何设置图标的大小告诉我咯~呵呵。。
方法二:经过上面的尝试,我禁掉了groupIndicator属性,然后再在group的xml中加入ImageView,这样可以控制我的图片的缩放和位置的更改,代码:
android:groupIndicator="@null"这里非常重要,禁用系统自带的图标
再在group的xml中设置ImageView,这个简单,然后在适配器的getGroupView中加入图片变换的效果:
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
……
ImageView mgroupimage=(ImageView)convertView.findViewById(R.id.mGroupimage);
mgroupimage.setImageBitmap(mla);
if(!isExpanded){
mgroupimage.setImageBitmap(mshou);
}
……
}
- 设置ExpandableListView右边的箭头
- 设置ExpandableListView右边的箭头
- 设置ExpandableListView右边的箭头
- 设置ExpandableListView右边的箭头
- 设置ExpandableListView右边的箭头
- 巧设置ExpandableListView右边的箭头
- 【Tech-Android-View】巧设置ExpandableListView右边的箭头
- ExpandableListView替换右边箭头的实现
- 设置ExpandableListView左边的箭头
- ExpandableListView箭头右边显示方法
- ExpandableListView 功能界面布局探究之一 ( 更换ExpandableListView右边的箭头(小图标))
- ExpandableListView 功能界面布局探究之一 ( 更换ExpandableListView右边的箭头(小图标))
- ExpandableListView的箭头问题
- 替换ExpandableListView右边箭头Group Indicator(小图标)
- ExpandableListView使用,点击条目请求网络数据,箭头在右边
- TextView右边箭头的显示
- 去掉ExpandableListView的箭头图标
- 去掉ExpandableListView的箭头图标
- lotusphp里面和thinkphp里面的C方法重复怎么解决
- Android学习笔记 - 目录
- uvaoj 1364 - Knights of the Round Table
- cookie 赋了值但是不起作用 需要先清空再赋值就可以
- 水晶报表打印乱码问题
- 设置ExpandableListView右边的箭头
- xmms安装配置工作记录
- Androi之Intent分析
- 在Windows使用VC编译ICU
- Mysql日志抽取与解析
- iOS中几个好用的宏定义
- vTiger CRM 6.1.0 更新补丁 20140925
- AADL Inspector 使用技巧(一)
- elasticsearch 与 hive集成