My need is to add a drop down menu like the one shown in attached image link.
http://i.imgur.com/cWtykfN.jpg
I don't know what to be used, whether it is tabs or menus. My need is when I press the last tab/menu, the sub menu should be shown and I could be able to handle the corresponding actions. Even when I handle those menus, I should be able to show the top tab/ menu without interruption.
It's called as overflow menus. Look this example, you will get an idea.
http://wptrafficanalyzer.in/blog/adding-action-items-and-overflow-menu-items-to-action-bar-in-android/
And nice explanation been given here. http://blog.stylingandroid.com/archives/1249 and for source code.ref here: https://github.com/StylingAndroid/StylingActionBar/Tree/StylingPart2
Use the ActionBar with tab-navigation-mode and if the last tab is clicked you could simply trigger a PopupMenu (even though this seems a little weird and is not what I expect to happen when I click tab).
Related
I recently put my hands on Android development and hence have to ask here a query that I have.
In my test app I have a BottomNavigationView, which has 3 options to click. I have seen in many apps that if a selection is tapped it further slides up another sub menu. I couldn't find enough information about this feature.
Looking for a direction if anyone has came across such requirement in the past.
This feature is deprecated now. look at say goodbye to menu button
if you still want to perform some action on navigation buttons, Override onBackPressed method in your activity so that you are able to perform some action on click of back button of bottom navigation bar.
I'm trying to create a custom popup/drop down menu on Android where when I click the action button from action bar the list of overflow options will appear but in a different format (image on right instead of left, button, etc). I tried to find some question and the one close to this is this question but the answer is incomplete and lacks the explanation. Now what I tried so far is to replicate it but removed the DropDown class but nothing happens as expected. I also tried some ways using the xml menu but its just giving me the same result of image on left and text on right. I think setActionView also doesn't work the way I expected it. Hope someone can help me on this.
I want to make a action-bar drop-down-menu that shows items (icons) horizontally. Like this:
This is suppose to be a action-bar withe drop-down menu, where you can choose a color.
So it should show the icons (colors) horizontally and the icons should be clickable. Until now I have only managed to make a vertical list.
If possible I would like to do this in XML.
The ActionBar is not designed for such a use-case. The ActionBar buttons are meant to replace the old options menu that could be triggered with a separate hardware button on older devices (pre HC/ICS). The overflow button (the one with the 3 dots) that you've drawn in your sketch is used when there isn't enough room to show all buttons (the Android framework takes care of this automatically), so those will be grouped in the overflow menu. Overriding this behavior is a bad idea (if even possible).
Instead you should consider another approach: Add one ActionButton to the ActionBar that is meant to handle the color chooser. When this button is clicked the best solution is to show an AlertDialog (you can easily insert your on Views here that show the colors you want) because this will work best even if the button is hidden in the overflow menu.
Alternatively you could trigger a PopupMenu or implement some QuickAction to handle the color chooser (this will probably suck if your button is hidden in the overflow menu and will also lead to a very confusing UI).
I want to create a app with a menu at the bottom of the screen. This menu should be visible any time the app is started.
Im working with fragments, so the menu is one fragment.
So I have only one Activity as controller which loads different fragments above the menu fragment.
Because I want to create clean code, i dont know how to solve the problem that the Activity class is too big.
In other words, i want to create different controller within the same activity. How to do that?
Is there another approach to solve this issue?
You should be using the split action bar This allows you to put the Actions and overflow menu on the bottom of the screen. I believe you can use Action Bar Sherlock for backwards compatibility to older versions of Android. See their site for detail.
Another possibility is to look into using fragments with the ViewPager . Here is a library that works with compatability as well ViewPageIndicator . Here is a blog post , like I indicated in my comment I got this working with the tabs showing at the bottom and the pages above.
I feel stupid for asking: What are the drop menus on honeycomb apps called? I'd like to use them in my app but i don't even know where to start.
An Example from Google Music, notice the triangle in the corner:
Here it is opened:
I found the Menu, which appears in the top right. I don't think they are context menus which you usually see associated with long holding touches.
(I realize these images are from the website, but they are all over honeycomb apps too)
The action bar will display your Activity's options menu in the top right automatically, but PopupMenu might be what you're looking for. It lets you generate a simple popup menu anchored to any View in your UI. Inflate a menu resource into the Menu object returned by getMenu, set a listener to respond to the user making a choice from the menu and call the show method.