我讨厌成为第三个人问这个问题,但是之前的 two askings似乎还没有完全回答。 android设计指南详细borderless buttons ,但不是如何制作它们。在之前的一个答案中,有一个建议使用:
style="@android:style/Widget.Holo.Button.Borderless"
这适用于 Holo 主题,但我也使用了很多 Holo.Light 和
style="@android:style/Widget.Holo.Light.Button.Borderless"
似乎不存在。有没有办法在 Holo.Light 中为此类无边框按钮应用样式,或者更好的是,只需应用无边框标签而不指定它属于哪个主题,以便应用程序可以在运行时选择正确的样式?
Holo.ButtonBar 似乎符合我的要求,但它没有提供用户反馈它已被按下。
此外,文档中是否有一个地方列出了可以应用的此类样式并对其进行了描述?无论我用谷歌搜索多少,并搜索文档,我都找不到任何东西。如果我右键单击并编辑样式,则只有一个非描述性列表。
任何帮助将不胜感激。
编辑:从 javram 得到了完美的答案,我想为任何有兴趣添加谷歌采用的部分边框的人添加一些 XML。
水平分隔线,效果很好
<View
android:id="@+id/horizontal_divider_login"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/holo_blue" />
这是一个垂直的:
<View
android:id="@+id/vertical_divider"
android:layout_width="1dip"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/holo_blue" />
最佳答案
只需在 Button
标记中添加以下样式属性:
style="?android:attr/borderlessButtonStyle"
来源:http://developer.android.com/guide/topics/ui/controls/button.html#Borderless
关于安卓无边框按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9695115/