I have a couple of questions about the new navigation view.
1) Scrolling the navigation view scrolls the whole view but I just want the header to stay at it's place and the navigation item to scroll.
2) To implement dividers b/w navigation items, I can do something like this:
<item
android:id="@+id/navigation_subheader"
android:title="@string/navigation_subheader">
<menu>
<item
android:id="@+id/navigation_sub_item_1"
android:icon="@drawable/ic_android"
android:title="@string/navigation_sub_item_1"/>
<item
android:id="@+id/navigation_sub_item_2"
android:icon="@drawable/ic_android"
android:title="@string/navigation_sub_item_2"/>
</menu>
</item>
But It does not work without the subheader. I tried to give it an blank string but that just leaves a vertical blank space instead of the subheader. I need the navigation item groups separated by dividers but without the subheaders.
3) Manipulating the navigation items dynamically. Before this, I used to use vertical list view as navigation item. Where I'd just set the visibility to gone of whichever navigation item I didn't want. How can I dynamically change the navigation items?
You can't obtain it with the current
NavigationView
. It follows the Material guidelines. If you would like this kind of pattern you have to use a custom view.You can use the standard
NavigationView
defining a menu like this:It is important to give an unique id to each group.
You can use something like: