I'm having action bar which display application Name, search and more action menu item, though i'm using sherlock library for that. I want to disable the toast of search and more item when i performing long press event in the action bar. Did anyone knows how to disable / redefine long press event.
This is a feature of the native action bar. It cannot be removed.
Related
I need to add some custom menu items in contextual action bar for WebView. My current research shows that only one of the following two things can be done.
Override action mode to supply custom action items. In this case default items are gone.
Use system provided action mode. In this way, I can't add my menu items.
May this will solve your problem.
https://github.com/TheFinestArtist/FinestWebView-Android
In my Activity i have an ActionBar with two action items. In this same activity i display contextual action bar with one action item for selecting multiple items and deleting them.
The problem i am facing is contextual action bar is passing the touch events to the action bar lying behind. So when i click on the contextual action bar the touch event is getting passed to action bar and it is processing onOptionItemSelected.
How do i avoid this?
One way i can think of is storing the ActionMode as a field in the activity and then using that to find if the action mode is visible and decide whether to process the onOptionItemSelected call.
Any other way that this can be avoided?
I'm looking to show the action bar "action mode" persistently throughout the life on an activity. This activity edits an image and once the user clicks the check mark the image is saved and the activity exits. However, if they press back the edit process is canceled.
My action bar is translucent with overlay content set to true. Here is how it looks.
Here is what I have tried
1. Action bar is translucent as well as my action mode. Action mode is overlayed causing a darkening of the action bar.
2. Make action bar transparent. Everything looks good but once you click the check mark you see an odd looking action bar without a background which is shown for a second.
3. Hide the action bar. This causes animation issues where you can see the action bar animate in while the activity is exiting.
All these attempts are hacks and they don't work well. Maybe I can somehow add the check mark on the left? I'm not sure how to reproduce that action mode as my action bar. Hopefully someone has a good idea on how I can achieve the action mode style.
I'm developing an android app which doesn't have an action bar. I have the sign out and sync options as menu items. When I tried this in my Nexus 5, the menu button is nowhere to be found. It usually appears in the action bar. Is there a way to keep the menu button and hide the action bar at the same time?
Is there a way to keep the menu button and hide the action bar at the same time?
No. If you are not going to use the action bar, you cannot reliably use <menu> resources. Please put "sign out and sync options" in your own GUI, such as via buttons.
Note that the MENU key is itself deprecated now; few devices going forward will have one.
I disable/enable an action item (represented with an icon, not in the overflow menu) on the Action Bar based on if the action is allowed or not. I would like to add a Toast when the user taps on the disabled action item icon to inform why this is disabled. Is it possible to detect a tap on a disabled item in the action bar??
Thanks
No, because it is disabled. Your alternative is to leave the action item enabled, but change icons instead of enable/disable, so you get control in all cases. This is not the best from an accessibility standpoint (those who cannot see your icon will not necessarily realize that it is "disabled").