6

I cant seem to find the Menu softkey on my Nexus 9 and nexus 5 [Android Version Lollipop]. All the apps that i had developed which contained option menu are not displaying menu softkey. So i am unable to access that option menu.

Also some of my apps don't use Actionbar/Toolbar because of their design requirements so i am looking for a solution without adding Actionbar/Toolbar.

So i was wondering, Is there a way to display Menu softKey in Android Lollipop ?

Updated:

enter image description here This is a sample app that i found on my Nexus 9. As you can see it has the action overflow button for legacy apps. Can anyone tell me how the did that ?

Sheraz Ahmad Khilji
  • 8,300
  • 9
  • 52
  • 84

2 Answers2

6

As per this blog post: http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html

If your app runs on a device without a dedicated Menu button, the system decides whether to add the action overflow to the navigation bar based on which API levels you declare to support in the manifest element. The logic boils down to:

If you set either minSdkVersion or targetSdkVersion to 11 or higher, the system will not add the legacy overflow button.

Otherwise, the system will add the legacy overflow button when running on Android 3.0 or higher.

The only exception is that if you set minSdkVersion to 10 or lower, set targetSdkVersion to 11, 12, or 13, and you do not use ActionBar, the system will add the legacy overflow button when running your app on a handset with Android 4.0 or higher.

So basically check your Manifest file.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • May be its a hack but for showing option menu on lollipop is changed my build target to lollipop 5.0.1 and added to manifest file. And now it shows the action overflow icon. Though i am still confuse that setting only minsdkversion in manifest worked – Sheraz Ahmad Khilji Dec 12 '14 at 12:54
2

Add

  • YourActivity extends AppCompatActivity
  • Add method onCreateOptionsMenu and inflate menu (getMenuInflater().inflate()(R.menu.menu_file, menu);
  • Add to res->menu-> menu_test.xml -> any item with(app:showAsAction="ifRoom")