3

I am trying to implement 'Expandable Listview' inside Navigation Drawer like in the picture below. There are 4 groups, and each group has many children. My problem is, the height of expandable listview is "short". How can I make this height reach the bottom of system bar just like a normal navigation drawer using listview with 4 groups data?

expandable listview

this is my main_activity.xml :

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>

<ExpandableListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/black"
    android:dividerHeight="1dp" 
    android:indicatorRight="430dp"/>

</android.support.v4.widget.DrawerLayout>

Any help would be greatly appreciated. Environment: Windows 7, ADT, Genymotion.

Hendy
  • 265
  • 1
  • 6
  • 27
  • 1
    android:layout_width="240dp" chage it by android:layout_width="match_parent" – Sandeep Tiwari Jan 03 '14 at 07:30
  • @Sandeep Tiwari i already change the width to match_parent but it's sill not working – Hendy Jan 03 '14 at 07:37
  • I am trying to create a similar navigation drawer, but I don't know how to make some items expandable while others aren't. Please attach a picture of the item expanded so the formatting is visible. – AlleyOOP Mar 15 '15 at 23:32

1 Answers1

1

Set background color to ExpandableListView as well

<ExpandableListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/black"
android:dividerHeight="1dp" 
android:indicatorRight="430dp"
android:background="#fff"/>

I think your expandable list is match_parent but it has no background and only 4 items.

vipul mittal
  • 17,343
  • 3
  • 41
  • 44