设置ExpandableListView右边的箭头
来源:互联网 发布:浏览器收集用户数据 编辑:程序博客网 时间:2024/04/29 15:04
androidxmlencodingnullc
1、更换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);
}
……
}
OK,搞定它:
转载自:http://hi.baidu.com/%C1%D6%B5t%B3%CE01/blog/item/5186f1f9d23c8e72024f5617.html
- 设置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的箭头图标
- opencv学习(1)
- 引导装载程序做什么
- 《第五项修炼》读书笔记
- sqlite数据库使用方法
- 将Excel中存储为文本的数字转换为数字格式
- 设置ExpandableListView右边的箭头
- 蛋疼的js 之 cookie
- extjs4 treepanel动态改变行高度例子
- 散列/哈希查找 C语言实现
- jQuery 效果 - 淡入淡出
- JS获取屏幕大小
- TC SRM573 div2 p1000
- MySQL修改表结构之(添加新字段或修改表名)
- android Button,textView 等控件设置控件内嵌周围图片使用方法