Abdullah
Abdullah

Reputation: 37

How can I create android menu

I want to create menu like this menu

because when I did like in the link it is appear on the top and I want it down as in the link

this is my menu

This is my java File look at to these code and I am waiting for answers please

@Override
        public boolean onCreateOptionsMenu(Menu menu)
        {
            MenuInflater menuInflater = getMenuInflater();
            menuInflater.inflate(R.layout.menu, menu);
            return true;
        }
        @Override
        public boolean onOptionsItemSelected(MenuItem item)
        {

            switch (item.getItemId())
            {
            case R.id.undo:

                Toast.makeText(Map.this, "Bookmark is Selected", Toast.LENGTH_SHORT).show();
                return true;

            case R.id.track:
                Toast.makeText(Map.this, "Save is Selected", Toast.LENGTH_SHORT).show();
                return true;

            case R.id.Hyper:
                Toast.makeText(Map.this, "Search is Selected", Toast.LENGTH_SHORT).show();
                return true;

            default:
                return super.onOptionsItemSelected(item);
            }
        }   

This is my XML file

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item 
          android:id="@+id/undo"
          android:icon="@drawable/icon_bookmark"
          android:title="Bookmark" />

    <item android:id="@+id/track"
          android:icon="@drawable/icon_save"
          android:title="Save" />

    <item android:id="@+id/Hyper"
          android:icon="@drawable/icon_search"
          android:title="Search" />
</menu>

Upvotes: 1

Views: 53

Answers (1)

MatheusJardimB
MatheusJardimB

Reputation: 3677

You're looking for Android Action Bar menu itens: Take a look: http://developer.android.com/guide/topics/ui/actionbar.html

Upvotes: 3

Related Questions