Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Menu Softkey is not displaying on Android Lollipop Devices [Nexus 9 and nexus 5]

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 ?

like image 631
Sheraz Ahmad Khilji Avatar asked Dec 12 '14 11:12

Sheraz Ahmad Khilji


2 Answers

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.

like image 142
Marcin Orlowski Avatar answered Sep 19 '22 12:09

Marcin Orlowski


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")
like image 44
Artur Garbacik Avatar answered Sep 18 '22 12:09

Artur Garbacik