Reputation: 7029
I have a drawerlayout in an app that works nicely, but I want to have things like buttons and textviews in the actionbar. This isn't possible with the default actionbar because you got menu items which have their limitations.
Basically what I want is this:
So a navigation drawer on the left and a custom actionbar view on the right. icons with text below and messagecounts aren't possible with the default actionbar. So how do I stack an custom actionbar next to the navigation drawer like this?
Upvotes: 0
Views: 907
Reputation: 7029
The answer is quite simple really, you can set a custom view in the actionbar that lets you put any .axml you want, in the activity onCreate():
ActionBar.SetCustomView(Resource.Layout.layout_custom_actionbar);
ActionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom);
Note this is Xamarin c# code, but in java it should be the same except for camel casing.
Upvotes: 1
Reputation: 10338
I did it by creating removing the action bar making a actionbar like layout using relative layout(height set to 48dp) and adding the DrawerLayout.DrawerListener listener to interact with the navigation drawer. Change the image when the drawer is open and close. Its preety easy though.
Upvotes: 0