1

I would like to display three dot menu in my app also on devices with android lower than version 3.0.

But on devices with Android version < 3 is menu displayed only after menu button pressing.

I tried to find any wotking solution for this but none from them working from me. What is most easy way how to solve it on all devices?

Im using appCompat_v7_3

Many thanks for any advice.

Here is code of menu and activity.

menu main_activity.xml

<?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:id="@+id/last_position_menu_btn"
        android:icon="@drawable/ic_drawer"
        android:title="@string/last_positions"
        android:showAsAction="always"/>
    <item android:id="@+id/settings_menu_btn"
        android:icon="@drawable/ic_drawer"
        android:title="@string/app_settings"
        android:showAsAction="always"/>
</menu>

onCreateOptionMenu from main Activity

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main_activity, menu);

        return super.onCreateOptionsMenu(menu);
    }
redrom
  • 11,502
  • 31
  • 157
  • 264
  • try this stack Overflow question [link][1] [1]: http://stackoverflow.com/questions/23261125/android-oncreateoptionsmenu-is-not-displaying – Anil M H May 13 '14 at 09:20
  • Thanks, but removing the line android:targetSdkVersion="18" from manifest is not solution. – redrom May 13 '14 at 09:41

1 Answers1

0

Your 3.0 device has a hardware menu button. Android does not display the overflow icon when there is a hardware menu button present.

See this question or the documentation.

Community
  • 1
  • 1
Michiel
  • 468
  • 3
  • 23