Reputation: 997
I have created menu button which have two functions bookmark and home button. This is working well in all the android version without android 3.0
do here any ways ? so my menu button will be display also in android 3.0 with all the version.
my code:-
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.menu_bookmark:
db.updateContact(new Contact(itemN,imageStatus));
return true;
case R.id.home_page:
Intent i = new Intent(imageTouchs.this, Comics.class);
startActivity(i);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.layout.menu, menu);
return true;
}
and my androidmanifest.xml :-
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
menu.xml :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_bookmark"
android:title="Bookmark"
android:showAsAction="ifRoom|withText" />
<item android:id="@+id/home_page"
android:title="Home"
android:showAsAction="ifRoom|withText" />
</menu>
any menu is not display in action bar
Upvotes: 0
Views: 161
Reputation: 27748
If you are talking about the OverFlowMenu
icon, to the best of my knowledge, it cannot be achieved (forced) using the standard Android Support Library.
If you must have an OverFlowMenu
(forced), you will need to use the ActionBarSherlock library. Go through a couple of my answers where I have a few fairly detailed suggestions on how to achieve that:
NOTE: As already mentioned in both my answers linked above, this is not recommended to ensure users get a seamless UI on their devices. And also, if you must absolutely force the OverFlowMenu
, you will need to use an older version of ABS, which is again, not recommended.
Upvotes: 1
Reputation: 18725
The "overflow' button will only show up when there isn't a physical menu button on the device. This is the standard behavior for the ActionBar.
You can actually set the value of your AVD to specifically not have a menu button when you are configuring the image.
Here is a SO question addressing this same thing: Action bar overflow not displayed
Upvotes: 1