Mikhail
Mikhail

Reputation: 398

How to make a button like in a Menu (OptionMenuItem)?

There is a (Menu menu) which I've already filled with MenuItems. There is also custom dialog, which I want to use instead of standart OptionMenu. I decided to use Button instead of ItemMenuView in it.

So I fill my custom dialog with Buttons, add the icon and the text of MenuItem to every Button and as a result get a completly awful 'Menu'.

My question is, describe please step by step how to make a common Button (or not a Button) looks like a common MenuItemView.

Thaks in advance!

Upvotes: 0

Views: 1186

Answers (1)

Mikhail
Mikhail

Reputation: 398

That's turned up pretty enough for me:

<ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.33"
        android:id="@+id/menu_btn1"
        android:background="@drawable/custom_button"
        android:src="@drawable/menu_btn1"
        />

where drawable/custom_button I left empty and drawable/menu_btn1 represents common selector with pressed/enadled states

Upvotes: 1

Related Questions