繁体   English   中英

ActionBar actionView项目样式

[英]ActionBar actionView item style

我正在尝试在操作栏项上创建一个弹出窗口(例如G +应用中的弹出窗口)。

为此,我需要具有操作栏项目视图,但这仅可通过setActionView()设置自定义视图来使用。

问题是我无法达到动作栏项目的相同菜单项样式。

我正在使用这个:

<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">

但是结果不好。

在哪里可以找到模仿动作栏项目的布局/样式?

解决方案是使用以下布局:

    <?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>

样式为@android:style/Widget.Holo.ActionButton

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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