CustomBottomSheetBehavior icon indicating copy to clipboard operation
CustomBottomSheetBehavior copied to clipboard

How to change/hide menu items on bottomsheet Toolbar

Open rakesh1988 opened this issue 7 years ago • 4 comments

I tried to add mToolbar.getMenu().clear(); in init() of MergedAppBarLayoutBehavior. But It did not clear the menu items. is there something that I am missing?

rakesh1988 avatar Mar 18 '17 06:03 rakesh1988

You probably don't want to do this in the Behavior, but in your Activity's (or Fragment's) onCreateOptionsMenu

On Mar 17, 2017 11:45 PM, "Rakesh Kashyap" [email protected] wrote:

I tried to add mToolbar.getMenu().clear(); in init() of MergedAppBarLayoutBehavior. But It did not clear the menu items. is there something that I am missing?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/miguelhincapie/CustomBottomSheetBehavior/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoGr2Xbh-QIGd2kkPim62FXfj0Bw3J5ks5rm311gaJpZM4MhUJ1 .

vit001 avatar Mar 18 '17 07:03 vit001

correct me if i am wrong... Activty/Fragment's onCreateOptionsMenu would change the toolbar that was set for the activity itself. In my layout xml i have 2 Toolbars. one for activity and one for BottomSheet. How will I change it for BottomSheet's toolbar?

rakesh1988 avatar Mar 18 '17 07:03 rakesh1988

Ok, you can try something like this (in your onActivityCreated or whenever you want to modify the toolbar:

final Toolbar scroll_toolbar = (Toolbar) findViewById( R.id.scrolltoolbar ); scroll_toolbar.setTitle( "Title" ); scroll_toolbar.inflateMenu( R.menu.scroll );

On Mar 18, 2017 12:53 AM, "Rakesh Kashyap" [email protected] wrote:

correct me if i am wrong... Activty/Fragment's onCreateOptionsMenu would change the toolbar that was set for the activity itself. How will I change it for BottomSheet's toolbar?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/miguelhincapie/CustomBottomSheetBehavior/issues/42#issuecomment-287523603, or mute the thread https://github.com/notifications/unsubscribe-auth/ADoGr3XYtaApaljz6XmQhxmO0C5-49XKks5rm41igaJpZM4MhUJ1 .

vit001 avatar Mar 18 '17 08:03 vit001

Assuming that you are referring to the second toolbar. I tried this in oncreate of the activity. It did not change the title or inflate the menu. I am modifying the latest version of the repo.

rakesh1988 avatar Mar 18 '17 08:03 rakesh1988