Option menu with bottomsheetfragment

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Option menu with bottomsheetfragment



i want this type of option Menu . I also created the sheet fragment as below but how can i connect that with option menu



enter image description here





Use this library. It will use same menu.xml for loading the bottom sheet. If your requirement is different let me know. I will update the answer. github.com/Kennyc1012/…
– Gnanendra Kumar
4 mins ago




1 Answer
1



You can use NavigationView inside the BottomSheet and then add menu to the NavigationView as shown below.



Step 1: Add NavigationView to the layout file of the BottomSheet.


<com.google.android.material.navigation.NavigationView
android:id="@+id/navView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_drawer_menu" />



Note: The line app:menu is used to inflate the menu inside the NavigationView.


app:menu



Step 2: Create the menu named "bottom_nav_drawer_menu" and add items to it which you want to show.


<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="none">


<item
android:id="@+id/nav1"
android:icon="@drawable/icon_appointment"
android:title="Appointments" />
<item
android:id="@+id/nav2"
android:icon="@drawable/icon_health_record"
android:title="Documents" />

</group>
</menu>





Sir, While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Please read this How to Answer
– Nilesh Rathod
9 mins ago





Navigation view work fine with this bottomsheetfragment but how to inflate option menu with fragment?
– Tushar Dubey
8 mins ago





@NileshRathod Thanks for the suggestion. Have improved the answer.
– Mehul Kanzariya
42 secs ago





@TusharDubey Have a look at the updated answer.
– Mehul Kanzariya
21 secs ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

IK6A7nQ1WvY 5BK6hbJh VLyd1,GePBq8YiN6GbXbMZow wAYMqePEedUaEf,bn7 Ac6yxgXKx
2BVr,gapigFv TdpwJqu5kK,y7ZpJMCwFOy,Dtt6d NadIhGfnSipn2u67

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham