2
votes

I would like to get action overflow buttons to be shown in my application.

action overflow buttons: are these:

I follow these instrutions:

  • 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 i did just like i read the last point of the list.

Here are my settings in my app:

Activity: I print out whether i have menu button or not, which i got result of "NO"

public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (ViewConfiguration.get(this).hasPermanentMenuKey()) {
        Log.i("MenuButtonIsAvailable", "YES");
    } else {
        Log.i("MenuButtonIsAvailable", "NO"); //I got this on logcat.

    }

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

Manifest snippet: I set minSdkVer to 10, and targetSdkVer to 11 which is a prefered options for showing legacy overflow menu buttons.

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="11" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

//...

styles.xml: I turn off ActionBar in my app's style.

<resources>


    <style name="AppBaseTheme" parent="android:Theme.Light">

    </style>


    <style name="AppTheme" parent="AppBaseTheme">

       <item name="android:windowActionBar">false</item>
    </style>

</resources>

After all these methods, i do not see the overflow menu buttons. What shall i modify in my settings?

1
What you are referring to is the "menu button of shame". No developer should be trying to get the menu button of shame to appear. Users will think that the developer is lazy and has not updated the app in years. Googlers and other UX experts will decry the poor UI of your app. If you do not want to use the action bar, that is fine, but then roll your own menu system that is an integrated part of the rest of your UI.CommonsWare
I would bet my life that this comment is from CommonsWare. I realized a bug - associated with this problem - and i want an urgent solution. I do not care Googlers and UI experts (wtf is that btw), i only care for my client's wish, because he do puts money in my pocket and Google UI expert do not.Adam Varhegyi
It says "If you set either minSdkVersion or targetSdkVersion to 11 or higher, the system will not add the legacy overflow button". But you have set targetSdkVersion to 11. Did you find a solution to this ? Im thinking of setting minSdkVersion and targetSdkVersion to 10 in my app.AsafK

1 Answers

0
votes

The page http://developer.android.com/design/patterns/compatibility.html says that it will only appear for app

that was built for Android 2.3 or earlier

but you build for android:targetSdkVersion="11" -> Android 3.0

https://source.android.com/source/build-numbers.html