您当前的位置: 首页 >  android

xiangzhihong8

暂无认证

  • 5浏览

    0关注

    1324博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Android之ExpandableListView下拉分组的实现

xiangzhihong8 发布时间:2013-12-26 10:08:40 ,浏览量:5

ExpandableListView是android中可以实现下拉list的一个控件,具体的实现方法如下:

首先:在layout的xml文件中定义一个ExpandableListView

view plain copy to clipboard print ?
  1.   
  2.       
  3.       
  4.   
 

定义两个List,用来存放控件中Group/Child中的String

view plain copy to clipboard print ?
  1. private List groupArray;  
  2. private List childArray;  
 

对这两个List进行初始化,并插入一些数据

view plain copy to clipboard print ?
  1. groupArray = new ArrayList();  
  2. childArray = new ArrayList();  
  3.   
  4. groupArray.add("第一行");  
  5. groupArray.add("第二行");  
  6.   
  7. List tempArray = new ArrayList();  
  8. tempArray.add("第一条");  
  9. tempArray.add("第二条");  
  10. tempArray.add("第三条");  
  11.   
  12. for(int index = 0; index 
关注
打赏
1482932726
查看更多评论
立即登录/注册

微信扫码登录

0.0492s