navigation drawer layout with include layout
android, android-layout, navigation-drawer
Solution
Your included layout declares a second `android.support.v4.widget.DrawerLayout`, it shouldn't. Just declare a `ListView` in your included layout.
File drawer.xml:
<?xml version="1.0" encoding="utf-8"?>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/left_drawer"
android:entries="@array/features"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:choiceMode="singleChoice"
android:divider="@null"
android:background="#E0E0E0"
android:dividerHeight="0dp"
/>
Problem
i think my problem is actually quite simple, but i can't figure out how to solve it. a have a working navigation drawer with this code: ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" > <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/category_list_view" android:layout_width="match_parent" android:layout_height="wrap_content"> </ListView> </FrameLayout> <!-- The navigation drawer --> <ListView android:id="@+id/left_drawer" android:entries="@array/features" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="left" android:choiceMode="singleChoice" android:divider="@null" android:background="#E0E0E0" android:dividerHeight="0dp" /> </android.support.v4.widget.DrawerLayout> ``` but when i try do use include like this: ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" > <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/category_list_view" android:layout_width="match_parent" android:layout_height="wrap_content"> </ListView> </FrameLayout> <!-- The navigation drawer --> <include layout="@layout/drawer"/> </android.support.v4.widget.DrawerLayout> ``` nothing happens when i click on the items of my list view within my frame layout. this is the drawer layout i'm trying to include: ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" > <!-- The navigation drawer --> <ListView android:id="@+id/left_drawer" android:entries="@array/features" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="left" android:choiceMode="singleChoice" android:divider="@null" android:background="#E0E0E0" android:dividerHeight="0dp" /> </android.support.v4.widget.DrawerLayout> ``` thanks for helping!