list and expandable list in single drawer

五迷三道 提交于 2019-12-13 10:24:32

问题


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!...


回答1:


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;
       }


来源:https://stackoverflow.com/questions/32710875/list-and-expandable-list-in-single-drawer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!