satheesh
satheesh

Reputation: 93

Three dot menu for more options in android

I want to show three-dot Button in android xml,when clicking on that Button it should display more options. Can any one help me how to implement the three-dot menu Button in android to get the more options.

Upvotes: 1

Views: 12490

Answers (1)

Christopher Francisco
Christopher Francisco

Reputation: 16268

Just create an XML file inside res/menu and inflate it this way

// inside activity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.game_menu, menu);
    return true;
}

And the XML should be something like this

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

Read this for more information: http://developer.android.com/guide/topics/ui/menus.html

Upvotes: 2

Related Questions