I'm using ActionBarCompat in my app, an I want to show one or two items in the action bar
I follwed the guide of google developers, but when I test it, the items are showed in the "Overflow" option (in Nexus 4) and if I tap on the menu button if there exist (ex. Galaxy S3)
What I've doing wrong?
SOLUTION FOUND
You can find it in a answer.
I had the same problem, and found two solutions:
In the menu xml (Login.xml), use your app name for the showAsAction tag:
instead of:
use:
I suppose your application's name is shady.
the second solution for me, on the activity class, at the onCreateOptionsMenu()
if you are using backCompatibility, change last line:
We have two ways to solute this problem.
OR 2. You need add libs "android-Support-v7". If you choice this method ,then your menu.xml need like this:
This is also true for the Android Toolbar in new Material Design concepts in the AppCompat-v21 and API levels 21 and above.
The question has been updated to include the answer, but for anyone who is interested in the official documentation, see http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems and pay particular attention to the note about using a custom namespace for the
showAsAction
attribute.I found the solution so I posted as Answer:
SOLUTION FOUND
In the xml of the menu, you have to put the new namespace, to make actionbarcompat work. So there are some options that need this spacename instead of "android". So the solutions is This:
Old Login menu:
New Login Menu (solution) (Look at how is caled "showAsAction")
Login.xml (MENU)
LoginActivity.java
Manifest