0

In my application, I am using sub-menus to group some elements together (see XML below). It works fine on devices without a hardware menu button, but I am having issues with devices with an hardware button.

When it works, I can click on "Sort" in the menu, and it display a new menu in place of the first one with the corresponding option.

When it does not, a dialog opens with the sub-menu options. This dialog has a light theme with white texts, so it is unusable. Is there a way to make it behave the same way as on device without a hardware menu button? Or at least have a correctly styled dialog?

I found this https://stackoverflow.com/a/11438245, but it feels like a hack, and does not seem to work for all devices.

<?xml version="1.0" encoding="utf-8"?>
<menu
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:title="@string/sort"
        app:showAsAction="never">
        <menu>
            <group
                android:id="@+id/menu_sort"
                android:checkableBehavior="single">
                <item
                    android:id="@+id/menu_sort_a"
                    android:title="@string/sort_a"/>
                <item
                    android:id="@+id/menu_sort_b"
                    android:title="@string/sort_b"/>
                <item
                    android:id="@+id/menu_sort_c"
                    android:title="@string/sort_c"/>
                <item
                    android:id="@+id/menu_sort_d"
                    android:title="@string/sort_d"/>
            </group>
        </menu>
    </item>
</menu>
Community
  • 1
  • 1
Gaëtan
  • 11,912
  • 7
  • 35
  • 45

1 Answers1

0

I created an issue for this. Let's pray for it to be resolved soon.

Kanedias
  • 386
  • 5
  • 7