I would like to get action overflow buttons to be shown in my application.
action overflow buttons:
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?