How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets which does't have menu button. ?
I am running application as <uses-sdk android:minSdkVersion="5"/>
in Manifest, code is compiled with 4.0
. Three-dot indicator shows on every screen.
Example for preference activities i don't want show Three-dot indicator, since it does't have any menu options.
Adding android:targetSdkVersion="14"
in manifest it works. However don't want hide/remove three dots button on all screens . Only in preference activities don't want to show this three dots button.
There is no way to show/hide "three-dot" menu indicator for a single activity. You can hide this menu indicator only for entire app by specifying android:targetSdkVersion="14" (or above) in your manifest file.
However, this menu indicator is not showing on preferences activity if it extends from native android.preference.PreferenceActivity class. I have this scenario implemented in a few of my apps, and it works perfectly.
I assume you are using some custom preferences implementations which does not extends from PreferenceActivity. Android Dev Team suggests to always use PreferenceActivity for any preferences in your applications.
Remove this item in
res / menu / main.xml
In addition: do not add an item that has
showAsAction="never"
- this will avoid the dots from showing. If you have more items than can not be shown at once the dots will be there again (and they are items that are flaggedifRoom
).If you simply want to hide the button, this solution is a bit of a hack but works across all versions of Android (using AppCompat) and doesn't affect your other menu items:
styles.xml
If you want the Overflow button hidden only on some screens, you could make this an alternate theme (change AppTheme above to AppTheme.NoOverflow) that only certain activities use :
AndroidManifest.xml
This effectively just makes the icon have no width and height. I rarely recommend opposing design guidelines but in my scenario we used dedicated hardware that did not properly report a menu button was present.
I just excluded the "onCreateOptionsMenu"-method:
Should be:
If MainActivity is
In MainActivity Class, Remove the below code.