简体   繁体   中英

ActionBar actionView item style

I am trying to create a popup on the actionbar item (like the one in G+ app).

To do this, I need to have the actionbar item view but this is available only setting a custom view with setActionView() .

The problem is that I cannot reach the same menu item style of actionbar items.

I am using this:

<Button xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/actionButtonStyle"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:paddingLeft="12dp"
    android:paddingRight="12dp"
    android:background="@drawable/ic_refresh">

but the result is not good.

Where could I find a layout/style to mimic the action bar item one?

The solution is to use this layout:

    <?xml version="1.0" encoding="utf-8"?>
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             style="@android:style/Widget.Holo.ActionButton"
             android:src="@drawable/ic_refresh">

</ImageButton>

with the style @android:style/Widget.Holo.ActionButton

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM