列表和可扩展列表在单个抽屉 [英] list and expandable list in single drawer

查看:150
本文介绍了列表和可扩展列表在单个抽屉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是初学者android我需要一些帮助关于列表和扩展列表在一个抽屉
我知道这个问题是发布在这里几个时间,但我无法理解,其实我想列出一个如下:

I am beginner to android I need some Help about List and Extended List in one Drawer I know that this question is posted here several Time but I am unable to understand that Actually I want to make a list like:

请帮助我一步一步
把你

Please Help me Step by Step thak you!...

推荐答案

这是 ExpandableListView 的本机行为,所以如果有项目没有孩子,隐含地不会被扩展,但是您需要为两个组(项目)和子项(选项)设置 OnClickListener

It's native behavior of ExpandableListView so if any Item doesn't have children, implicitly won't be expanded but you need to set OnClickListener for both groups (Items) and children (Options):

    public boolean onChildClick(ExpandableListView parent, View row, 
                               int groupPosition, int childPosition, long id) {

       // callback method after click for Options
       return false;
    }


    public boolean onGroupClick(ExpandableListView parent, View row, 
                                 int groupPosition, long id) {

       /** if you are using BaseAdapter subclass implementation **/

       adapter.getGroup(groupPosition)).getChildren() == null) {
          // item doesn't have children
           return true;
       }
       else {
          // has children
           return false;
       }

这篇关于列表和可扩展列表在单个抽屉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆