Issue
I created a navigation menu XML file for my project. nav_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group
android:id="@+id/group_note"
android:checkableBehavior="single">
<item
android:id="@+id/note"
android:icon="@drawable/all_notes"
android:iconTint="@color/black1"
android:title="Notes"/>
</group>
<group
android:id="@+id/group_days"
android:checkableBehavior="single">
<!-- all days will come here -->
</group>
<group
android:id="@+id/group_setting"
android:checkableBehavior="none">
<item
android:id="@+id/setting"
android:icon="@drawable/setting"
android:iconTint="@color/black1"
android:title="Settings" >
</item>
</group>
group_days item will dynamically. But the problem is, I except group_days after group_note. But it comes after group_setting! I don't know why.
Solution
I think problem is that all items
that you added in XML
have default order and that means next added items
will go below already added items like you have in your scenario. Try to give an order to your items for example for Notes
it will obviously be 0: android:orderInCategory="0"
and for Settings
try: android:orderInCategory="2"
and then for each new added item set category to 1
. For example:
menu.add(R.id.monday, Menu.NONE, 1, "Monday");
menu.add(R.id.tuesday, Menu.NONE, 1, "Tuesday");
//and so on
Answered By - Yupi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.