单个抽屉中的列表和可扩展列表

list and expandable list in single drawer

我是初学者 android 我需要一些关于一个抽屉中的列表和扩展列表的帮助 我知道这个问题在这里发布了好几次,但我无法理解实际上我想列一个列表:

请逐步帮助我 谢谢你!...

这是 ExpandableListView 的本机行为,因此如果任何项目没有子项,则隐式不会展开,但您需要为组(项目)和子项(选项)设置 OnClickListener ):

    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 **/

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