Can't get Android Menu to Show

Viewed 31

I am trying to get a 3 dot menu to show in my app but can't get it to work.

I have created a file called mymenu.xml under res/menu and the contents are:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/level"
        android:title="@string/Level"
        app:showAsAction="never">
</item>
</menu>

This is what is in my MainActivity.java file:

   @Override
    public boolean onCreateOptionsMenu(Menu my_menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.mymenu, my_menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

            case R.id.level:
                levelMax = 41;
                levelTextView.setText("Level:\nEasy");
                mCountDownTimer.cancel();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

What am I doing wrong? Any help would be appreciated. Thanks.

1 Answers

Change app:showAsAction="never" to app:showAsAction="always"

Related