1

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

Rami
  • 7,879
  • 12
  • 36
  • 66
Hanzala
  • 1,965
  • 1
  • 16
  • 43
  • This post could not be found. – IntelliJ Amiya Sep 22 '15 at 07:30
  • @IntelliJAmiya Link updated – Hanzala Sep 22 '15 at 07:52
  • check demo .Only for logic http://semycolon.blogspot.in/2014/11/first-android-app-step-13-view-pager.html#comment-form – IntelliJ Amiya Sep 22 '15 at 08:00
  • that implements only Expandable List view But I want to make different – Hanzala Sep 22 '15 at 08:08
  • You can achieve the result in your image using `ExpandableListView` with a custom adapter. – Rami Sep 22 '15 at 09:58
  • @Rami Plz explain it how.....to use custom adapter – Hanzala Sep 22 '15 at 10:02
  • Here is an example using custom layouts for child(item) and parent(group) views: http://androidexample.com/Custom_Expandable_ListView_Tutorial_-_Android_Example/index.php?view=article_discription&aid=107&aaid=129 . For exp you can create many group layouts (if you want a different representation for each group) and in `getGroupView()` method you inflate the desired one depending on position or whatever you want. – Rami Sep 22 '15 at 10:13

1 Answers1

0

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

       if(adapter.getGroup(groupPosition).getChildren() == null) {
          // item doesn't have children
           return true;
       }
       else {
          // has children
           return false;
       }
    }
Hanzala
  • 1,965
  • 1
  • 16
  • 43