android - AppCompatActivity actionbar and device menu button -


i using appcompatactivity actionbar style @style/widget.appcompat.light.actionbar. when create menu activity, overflow menu button appear in actionbar, if device don't have hardware menu button. but, on device xiaomi redmi note, overflow button apear in actionbar, , device has own hardware button. configs:

compilesdkversion 22 buildtoolsversion "22.0.1"  defaultconfig {     minsdkversion 10     targetsdkversion 22 } 

the appcompat-v7 support library forces overflow menu visible in action bar (or toolbar) every device kitkat , higher. menu key, if exists, still work, opening overflow menu. desired behavior , it's designed this.

the code pretty straightforward:

public boolean showsoverflowmenubutton() {     if (build.version.sdk_int >= build.version_codes.kitkat) {         return true;     } else {         return !viewconfigurationcompat.haspermanentmenukey(viewconfiguration.get(mcontext));     } } 

you can see full source code here: https://github.com/android/platform_frameworks_support/blob/master/v7/appcompat/src/android/support/v7/internal/view/actionbarpolicy.java#l49-l55


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -