I am working on an Android application where I have to design a menu which will populate from the action bar, like this:
I have tried my best but was not able to produce it using the Android controls.
The solutions I have tried are:
With Actionbar, add a menu item with a group with selectable="all", that produces the layout I need but when I click a checkbox for selecting it, the whole menu hides and selection is not done, moreover the menu icon in actionbar does not have the bottom right white arrow.
Tried creating a custom ActionProvider and added the menu items using class's OnPrepareSubMenu method but had the same issue.
I just need a push in the right direction and I can do the rest, suggestions are more than welcome.
Thank you :)
Use popupWindow.
In that you can make any custom layout and set it as content of your popupwindow and also you can specify an ANCHOR in your case it would be
R.id.your_menu_item
set a listener and listen the changes.
Related
Im using the BottomNavigationViewEx library to display a Bottom Menu Bar in my android app, the library works well and fixes many of the shortcomings of the standard BottomNavigationView.
The problem comes when as per requirements I need to show 7 options in the menu, with 4 options being the direct access to their respective functionality and a "More" option, that should show a submenu with 3 more options (similar to a toolbar with items with property showAsAction="never")
Since the library does not admit more than 5 items and does not support submenus either I've been trying to implement a solution to no avail. Is there a way to implement this or any other bottom menu library that I could use that implements submenus (or lets me extend it to create a submenu)?
#Jeav148, you can take help from androidhive tab tutorial.
https://www.androidhive.info/2015/09/android-material-design-working-with-tabs/
From this tutorial you can check the scrollable tabs, so you'll be able to add tabs as much menu items you want.
Just you need to use the tablayout inside RelativeLayout with property AlignParentBottom = "true" to show the tabs at bottom.
Even though Adil's answer could have worked, I didn't go for it since it could create other problems. So I ended up making a Popup Menu anchored to the last menu item in the BottomNavigationView
If I don't use show as action=always when creating a menu will it create a menu on the bottom like the old school android phones. I'm trying to create something that has like the facebook mobile tabs on the bottom, and has them for every screen. Or should I actually just make tabs for every screen?
You may be interested in a "split action bar". That way your items could appear at the bottom. showAsAction controls how/if the item appear in the Action Bar.
More information here: http://developer.android.com/guide/topics/ui/actionbar.html#SplitBar
If that doesn't look of interest then yes.. you should use tabs (or a view of some sort) at the bottom to render your "menu items".
I need to implement a custom overflow menu with menu items and the overflow icon if the screen size cannot show all the icons. I cannot use a side scroll since I am already inside an expanded list view. I cannot use the Top or bottom action bar menu because the action will change based on what list item has been expanded.
So I would like to create my own overflow menu - similar to the gmail screenshots attached
Any ideas? Apparently ABS can be used for this but I can't figure it out, please help :)
ListPopupWindow is what you're looking for. It's an API 11+ class, however. ABS includes a backported version which is basically just a ListView inside a PopupWindow (both API 1 classes).
I'm using ActionBarSherlock and creating a custom ActionProvider. When clicking on the custom action provider, I've managed to make the topmost LinearLayout clickable and set a custom selector on it.
The problem is that compared to simple menu item with an icon, the custom action provider doesn't use the selector to highlight the action bar entirely from top to bottom. A few pixels on top and bottom are not being highlighted.
There is probably an elegant solution to make the entire custom action provider behave like a simple clickable menu item with an icon. Any help will be greatly appreciated.
I figured it out. Instead of using an Action Provider, I used the actionLayout for the menu item and made it clickable as shown in this post.
According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.
Use tab navigation in the action bar and set a custom view with a Spinner
Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.
However, we still suffer the following problem, during landscape mode.
Note, the spinner ("Portfolio 1") is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.
Is there anything we may try out?
Thanks.
You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of "WATCH LiST"
in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)
a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link