Questions tagged [android-optionsmenu]

Used to display the options of a application on android devices, this can be at the bottom of the application when the menu-button is pressed or in the overflow-menu of the actionbar.

android-optionsmenu
Filter by
Sorted by
Tagged with
2 votes
4 answers
2k views

Implement 3 dot menu to a fragment

Hi guys i want to create 3 dot action bar menu at fragment level, the condition is i want to show that menu at just 1 fragment not on all and if i make them at my main activity, Then i can't hide them ...
Abdul.Moqueet's user avatar
5 votes
1 answer
5k views

Create Options Menu with custom actionbar/toolbar view

I have already implemented a custom view for my actionbar. Along with that, I also need an OptionMenu. Is there any way to still use the default OptionMenu? I dont want to design the entire menu &...
Pranav Mahajan's user avatar
-4 votes
1 answer
368 views

How to add an options menu to the menu Button

I want to add a menu on the left click. Where to read about how to do this? Here is the menu public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu....
Dr.Noname's user avatar
0 votes
2 answers
380 views

I want to remove the optionMenu when there are no items in ListView (emptyView is shown)?

I have an app that adds items to an sqlite database and returns a cursor, this cursor is then used with a custom CursorAdapter called StoreCursorAdapter to show the items in a ListView. There is a (...
user avatar
2 votes
0 answers
745 views

Actionbar(toolbar) of fragment in ViewPager not showing

I am trying to inflate Fragments inside ViewPager. When first it inflate it's calling onCreateOptionMenu() but not inflating the toolbar. Once the ViewPager hit setoffscreenpagelimit number of ...
Rushil Shah's user avatar
0 votes
0 answers
1k views

Android Studio Emulator keeps crashing when I run and press buttons on my layouts?

When I run any of the layouts, the launch activity layout should run first by default, ask me to log in, and then take me to the page/layout I am clicking. After I log in or register, the emulator ...
mm24mm's user avatar
  • 37
1 vote
1 answer
524 views

Android Studio: Why won't the options menu embedded on layout show on my emulator/preview?

Error says: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first. The following classes could not be found: item and ...
agentmg123's user avatar
1 vote
3 answers
345 views

Android options menu does not work?

I have a single Activity in my project. I created an options menu with 3 items. I don't know why but it does not work for me. Every time I select an item I get the item ID 0. res/menu/m1.xml: <?...
Momo Saibak's user avatar
10 votes
2 answers
5k views

Why does onCreateOptionsMenu run multiple times?

For some reason, my onCreateOptionsMenu and onPrepareOptionsMenu run twice (checked with a log input on the start of both methods). This happens for multiple fragments that I have, including some that ...
Timmiej93's user avatar
  • 1,357
1 vote
0 answers
42 views

How to make android options menu visible even no visible entries?

I have a Fragment that should have its options menu with a variety of entries that I add at runtime. When the fragment starts, all entries are invisible, and the options menu doesn't show up. In ...
trpnd's user avatar
  • 474
1 vote
3 answers
176 views

Options menu showing at different fragments(mostly in neighbour Fragment)

My view pager's Adapter is like: public Pager(FragmentManager fm, int tabCount) { super(fm); this.tabCount = tabCount; } @Override public Fragment getItem(int ...
Sam's user avatar
  • 171
4 votes
2 answers
4k views

Android: How to add a click listener to menu icon(3 dots at the top)?

The onOptionsItemSelected(MenuItem item) method can be used to identify a click on each menu item. But i need to have a listener that can identify the click on the menu title (3 vertical dots at the ...
Hari Krishnan's user avatar
8 votes
4 answers
16k views

How to change Options menu dots color for the theme "Theme.AppCompat.Light.NoActionBar"

To change the default option menu icon color(3 vertical dote), i have tried adding <item name="android:textColorSecondary">@color/white</item> But it doesn't make any change. I think it ...
Hari Krishnan's user avatar
4 votes
1 answer
3k views

Uncalled onCreateOptionsMenu with custom ToolBar

I'm using my own style in my AndroidApplication but it did not let me see the menu ( 3 dots ) also the activity title. Any suggestion? <style name="AppTheme.NoActionBar"> <item name="...
Alicia Beltran's user avatar
2 votes
0 answers
58 views

Why inner fragments menu is persisted?

This question is about options menus inflated from Fragments into a Toolbar, via Fragment#setHasOptionsMenu(true). Let’s say we have an activity with 3 fragments: FragmentA FragmentB (with menu) ...
natario's user avatar
  • 25.1k
1 vote
0 answers
192 views

Hide opened menu after orientation change android

In my application, there is requirement to show different menus on portrait and landscape mode. This I have achieved using calling invalidateOptionsMenu() in onCreate(); and then I check orientation ...
Hrushikesh Salkade's user avatar
1 vote
2 answers
4k views

Overflow menu's 3 dots are not showing up in ActionBar

I am new to android and I am trying to create an overflow menu. The 3 dots on the ActionBar are not showing (even after changing the app theme). After changing the app theme, it gets shown on the ...
Abdul Rafay's user avatar
1 vote
2 answers
431 views

Add separators and icons to android actionbar popup menu

I'm try to customize my app popup menu adding separators and icons. Basically I would like to obtain a menu like this (from Google Photos app): How can I achieve this? Thank you all in advance :)
Androidian's user avatar
  • 1,045
1 vote
2 answers
288 views

How to implement an OptionMenu in an Activity [duplicate]

I tried to implement this, without succes. The menu Buttons aren't showing. What's wrong with my code? My menu xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://...
user avatar
10 votes
1 answer
5k views

Clicking hamburger icon on Toolbar does not open Navigation Drawer

I have this nav drawer which was working perfectly fine. Refactoring my code I removed all onOptionsItemSelecteds in activities and made all activities inherit from a base activity which extends ...
Fatima's user avatar
  • 869
1 vote
2 answers
72 views

How to hide some menus in actionbar?

In my app I have nearly 8 menus and I have two types of users admin and client for Admin I need to show all 8 manus and for user I need to show 2 menus for user for that I have Given this @Override ...
Don't Be negative's user avatar
0 votes
1 answer
305 views

Menu items in one Fragment - Getting mixed up with other Fragment's menu items

I have an Activity with DrawerLayout and a RelativeLayout (with ViewPager and a FrameLayout as children for it) and a ListView as children. I am loading a Fragment inside the FrameLayout when an item ...
Vamsi Challa's user avatar
  • 11.1k
0 votes
1 answer
567 views

Android custom optionMenu in toolbar

I made an activity and implemented toolbar with options menu. How to change design from optionsmenu ?? This is how it looks now and need to achieve. MainActivity.class setSupportActionBar(toolbar); ...
trulala's user avatar
  • 23
15 votes
3 answers
8k views

Android actionLayout not showing with Toolbar

I'm trying to show custom layout as an item in options menu. And this is what I have done so far <item android:id="@+id/action_profile" android:orderInCategory="100" android:title="...
Nayanesh Gupte's user avatar
0 votes
0 answers
112 views

Peculiar volley error with OptionMenu android

I am making a simple app for an academic management system for a university. Initially, I had a MainActivity with an options menu loaded from an xml file, and a request being called to an API, both of ...
quantumcoder's user avatar
4 votes
0 answers
44 views

Options menu doesn't accommodate icons

I tried adding an icon to a menu item on my rooted Nook Simple Touch (API 7). The menu is only large enough to accommodate the text, so the icon is mostly off screen: I thought the icon might simply ...
Kevin Krumwiede's user avatar
3 votes
2 answers
1k views

how can i change the visibility of a menu item inside onOptionsItemSelected(..)

i have three menu items "enable, diable, exit". what i want to do is, when the R.id.menu_enable_bt is chosen, i want to disable it using menu.findItem(R.id.menu_enable_bt).setVisible(false); but i ...
Amrmsmb's user avatar
0 votes
1 answer
7k views

SearchView not showing any results in Text Change Listener or Text Submit

I am trying to implement a SearchView in OptionsMenu of a Fragment. The onQueryTextChange and onQueryTextSubmit is not working. I am not sure where am I going wrong. The menu file: <?xml version="...
kittu88's user avatar
  • 2,451
2 votes
2 answers
243 views

Showing a progressDialog from an OptionsMenu

I know the following is probably not the best practice and not recommended to do. I have an AsyncTask that sends data to server. The whole process that i need to do includes 4 web calls using this ...
turtleboy's user avatar
  • 7,998
0 votes
1 answer
92 views

menu on nexus 7 that does not have menu button

I am working on android app. I am testing and running my app on Nexus 7. I have created a menu. But its NOT appearing on Nexux 7 device. The OS codename on my device is KitKat. I found this resource ...
user786's user avatar
  • 4,144
0 votes
1 answer
594 views

Referencing options menu item as view throws NullPointerException

I'm building user guide with MaterialShowcaseView library. I plan to guide user through all toolbar options menu items in fragment (Theme.AppCompat with no action bar is used). Thus I need to ...
burzakovskiy's user avatar
0 votes
1 answer
1k views

Menu item from fragment can not trigger onOptionsItemSelected in activity

I want my activity to handle click on options menu items from fragment. and menu item from fragment showed at activity's menu. However, onOptionsItemSelected is not triggered when I click the button. ...
Bin's user avatar
  • 222
2 votes
0 answers
788 views

Changing fonts/typeface in android options menu

I'm trying to change typeface in an Android app. Everything works well except the MenuItems in OptionsMenu. Thanks to this link (How to set custom typeface to items in NavigationView?) I've modified ...
Eduard Fűzesséry's user avatar
0 votes
1 answer
409 views

Add Fragment with No UI to Activity from another Fragment

I am trying to add a worker Fragment to my MainActivity from a Fragment that was added to it. The Fragment implements a DownloadListener for the WebView it contains, is adding the worker Fragment when ...
Bryan's user avatar
  • 15k
2 votes
2 answers
3k views

Android Options Menu on Action bar shows duplicate icons

action bar (Toolbar) on android has 3 options menu. Its working fine. But the problem is when ever i am uninstalling and reinstalling this duplication of the menu item is showing. Also the Title is ...
Siva Sabharish's user avatar
3 votes
1 answer
526 views

Make a Toolbar just for the Activity or for each fragment separately?

I have an Activity which contains 3 fragments. In the Activity there is a toolbar with no menu items. The menu items get added via fragments onCreateOptionsmenu(). My code: in Fragments onCreate() ...
Ivan Javorovic's user avatar
0 votes
1 answer
785 views

Display/Hide Option Menu with Some condition

Does it is possible to Display/Hide the Fragment Option Menu with some condition. I have a fragment from which I add another fragment with some argument. According to the valid argument condition I ...
Krishnakant's user avatar
  • 1,493
0 votes
1 answer
114 views

Android OpenOptionsMenu not updating after firing off once

First off I have a baseadapter for a listview and each row has a unique message.I am trying to get OpenOptionsMenu to update after an OnClick event but what is happening is that after the 1st Onclick ...
user1949387's user avatar
  • 1,265
1 vote
1 answer
2k views

Creating new blank activity using Android Studio

I'm a new hand learning Android using Android Studio. While I follow the official tutorial Getting Started provided by Google, I encountered a problem: When I trying to create a new blank activity, ...
Meng-Jiun Chiou's user avatar
11 votes
2 answers
2k views

openOptionsMenu() will not work in appcompat-v7 22.1.0 or newer

I've seen several reports of issues where openOptionsMenu() will not work on various Android versions, eg: openOptionsMenu() across android versions openOptionsMenu() not working but the issue I ...
Steve Moseley's user avatar
1 vote
2 answers
1k views

Android: Options button missing android studio

In Android Studio, I am hiding the title bar, now I cant see options (3 dots) button in navigation bar. What should I do to make it appear in navigation bar, like (in eclipse, by default opt btn ...
Sri's user avatar
  • 85
2 votes
1 answer
266 views

ActionBar options and icons [duplicate]

I'm trying create an ActionBar for my Android app with Android Studio, but when I execute, the items don't appear. I set the showAsAction to always or ifRoom but nothing happened. Menu code: <?...
Felipe Neves's user avatar
9 votes
2 answers
1k views

Hide options menu on PreferenceFragment

I have an app with several fragments. Only A fragment has an options menu. A fragment could be initiated from fragment B (which extends listfragment). So B fragment does not have an options menu, ...
burjulius's user avatar
  • 279
4 votes
3 answers
4k views

Android options menu is transparent

I have been struggling with this problem for a while. I have no action bar but I do have a options menu. The options menu is transparent I can't get it to be not transparent. This problem arises ...
Matthew556's user avatar
0 votes
1 answer
387 views

Android Design Support Library - Tablayout with toolbar

I just made the jump from eclipse to Android Studio and I'm fixing some issues that have come up. One of which is removing the tab navigation offered by ActionBar and switching to the Tablayout ...
Warblr's user avatar
  • 1,188
0 votes
3 answers
202 views

Is there a better way or library to handle options menu in android actionbar/toolbar

I have an OptionsMenu which will contain only two items settings and logout. To implement it, I'm repeating the same code in each activity. i.e., implementing onCreateOptionsMenu and ...
lightsaber's user avatar
  • 1,481
0 votes
1 answer
87 views

Android Lollipop unintended options menu

All of my activities have no onCreateOptionsMenu or related methods. I deleted the menu.xml and all related ones as well. I still see the options menu on the right side of the bottom bar. Any ideas ...
Barışcan Kayaoğlu's user avatar
0 votes
1 answer
164 views

How to check menu option availability in android device?

I've developed an android application with Menu options. Unfortunately some devices don't have a menu option(soft or hard) availability to access menu options. We can detect hardware menu option ...
Raghu Mudem's user avatar
  • 6,903
0 votes
1 answer
684 views

Preserve the orderInCategory of items having showAsAction="ifRoom" set

How can I preserve the order defined by android:orderInCategory while the first options menu shows as one action when it's the only item of the menu? I have defined two options menus, which get ...
tynn's user avatar
  • 39.4k
1 vote
1 answer
748 views

Toolbar menu item programmatic click

I have this code toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { openSearch(); return true;...
Vihaan Verma's user avatar
  • 12.9k

1 2
3
4 5
8