Essayez comme ça
<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:background="@android:color/white"
android:fitsSystemWindows="true">
<include layout="@layout/home_content" />
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start|top"
android:background="@android:color/white"
android:fitsSystemWindows="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/lvExp1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.5"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:groupIndicator="@null"
android:scrollbars="none" />
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
Mise à jour: sur votre groupExpandListener écrire état
expandedListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
if (groupPosition == 0) { // EXPAND
expandedListView.collapseGroup(groupPosition);
} else if(groupPosition != 0 {
// Intent...
// Do your stuff
}
}
});
Merci, mais cela fera tout mon navigationdrawer comme ListView Extensible, mais je veux qu'un seul élément sera être une liste expandListview, l'autre sera juste élément simple – Caroline
Mis à jour ma réponse veuillez la vérifier encore une fois – Srihari