ExpandableListView研究
来源:互联网 发布:淘宝上直播怎么赚钱的 编辑:程序博客网 时间:2024/06/07 12:24
最近想做依照QQ做些那样的效果,所以就用到了ExpandableListView,在网上搜集了一些,在加上自己的总结,如下:
1.自定义 ExpandableListView 的group的样式
目的:把小箭头放在右边
先把 groupIndicator 属性禁掉,android:groupIndicator="@null",然后把自定义的布局加入
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View view = li.inflate(R.layout.expandable_group, null);
ImageView mgroupimage=(ImageView)view.findViewById(R.id.groupimage);
if(!isExpanded){
mgroupimage.setBackgroundResource(R.drawable.btn01);
}else{
mgroupimage.setBackgroundResource(R.drawable.btn02);
}
TextView tv = (TextView) view.findViewById(R.id.groupname);
tv.setText(groups[groupPosition]);
return view;
}
2.只展开一个group,点第一个gorup后,再点第二个group时,第一个会自动收缩
expandablelistview.setOnGroupExpandListener(new OnGroupExpandListener(){
@Override
public void onGroupExpand(int groupPosition) {
// TODO Auto-generated method stub
for(int i=0;i<groups.length;i++){
if(groupPosition != i){
elv.collapseGroup(i);
}
}
}});
3.点击时会出现全部变为黑色的情况
expandablelistview.setCacheColorHint(0);
使用前:
4.如果group没有child时,就不让它展开
expandablelistview.setOnGroupClickListener(new OnGroupClickListener(){
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// TODO Auto-generated method stub
if(childs.get(groupPosition).isEmpty()){
return true;
}
return false;
}});
5.
通过设置的控件transcriptMode属性可以将Android平台的控件(支持ScrollBar)自动滑动到最底部
android:fadeScrollbars
滚动条的自动隐藏和显示。
- ExpandableListView研究
- ExpandableListView研究
- ExpandableListView
- ExpandableListView
- ExpandableListView
- ExpandableListView
- ExpandableListView
- ExpandableListView
- expandableListView
- ExpandableListView
- expandablelistview
- ExpandableListview
- ExpandableListView
- ExpandableListView
- ExpandableListView
- Expandablelistview
- ExpandableListView
- ExpandableListView
- <Codeforces Round #127 (Div. 1)> B. Guess That Car!(难题)
- QC10.0安装体会
- poj 2186 Popular Cows
- xx is not in the sudoers file 问题解决
- linux设备驱动归纳总结(三):4.ioctl的实现
- ExpandableListView研究
- 如何在Drupal当中手动调用hook?
- 立体匹配中的NCC,SAD,SSD算法
- 使用 PowerShell 加密 SQL Server 的存储过程
- log4j.properties配置详解
- 黑马程序员--基础复习2012.8.8 银行调度系统
- Chrome中的开发者插件
- Javascript中的数学函数集合
- cocos2d中SpriteFrame和Texture