How to disable menu button popup menu items on S3?

I am just testing my app on Galaxy S3. The phone has a hardware menu button.

I am using one action to store some fragments, each fragment has its own action bar items to display. It works well on other phone, and for action bar only, it works well on S3.

My problem on S3, when I click this hardware menu button, it pops up in a list including all the current action item names defined on the snippet. The pop-up list is at the bottom of the screen. See screenshot below.

I wonder if there is a way to disable this behavior? I hope the application will ignore the hardware menu button press and just allow the user to use the action bar button. I've tried using dispatchKeyEvent, with a KEYCOD_MENU check, but doesn't seem to work.

Thank!

enter image description here

UPDATE:

For topics:

In the styles.xml values ​​folder:

<?xml version="1.0" encoding="utf-8"?> <resources>
    <style name="AppTheme" parent="AppTheme.Base"/>

    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">

        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>

    <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
        <item name="contentInsetStart">0dp</item>
    </style>

    <style name="Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
        <item name="contentInsetStart">0dp</item>
    </style>

    <!-- Style user drawer -->
    <style name="textView_title_list" parent="android:Widget.TextView">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:background">@drawable/bg_black_transparent</item>
        <item name="android:ellipsize">end</item>
        <item name="android:padding">4dp</item>
        <item name="android:layout_gravity">bottom</item>
    </style>

    <!-- ToolBar -->
    <style name="ToolBarStyle" parent="Theme.AppCompat">
             <item name="android:textColorPrimary">@android:color/white</item>
             <item name="android:textColorSecondary">@android:color/white</item>
             <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
         </style>


    <style name="SmallTitleText" parent="@android:style/TextAppearance.Medium">
        <item name="android:textSize">10sp</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:textStyle">bold</item>
        <item name="android:typeface">sans</item>
    </style>

    <style name="TextAppearance.Widget.ActionBar.Title"
        parent="@android:style/TextAppearance.Small">
    </style>


</resources>

      

And in values-v21:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="AppTheme.Base">
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
        <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
        <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
    </style>
</resources>

      

+3


source to share





All Articles