Android的材料设计按钮样式 [英] Android Material Design Button Styles

查看:157
本文介绍了Android的材料设计按钮样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑的按钮样式材料设计。我想获得丰富多彩的募集按钮像所附的链接,如强制停机,并在使用一节看到的卸载按钮。是否有可用的样式还是需要去界定?

I'm confused on button styles for material design. I'd like to get colorful raised buttons like in the attached link., like the "force stop" and "uninstall" buttons seen under the usage section. Are there available styles or do I need to define them?

<一个href="http://www.google.com/design/spec/components/buttons.html#buttons-usage">http://www.google.com/design/spec/components/buttons.html#buttons-usage

我找不到默认的按钮样式。

I couldn't find the default button styles.

例如:

 <Button style="@style/PrimaryButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Calculate"
    android:id="@+id/button3"
    android:layout_below="@+id/editText5"
    android:layout_alignEnd="@+id/editText5"
    android:enabled="true" />

如果我试图通过增加改变按钮的背景颜色

If I try to change the background color of the button by adding

    android:background="@color/primary"

所有的风格走,如触摸动画,影子,圆润的边角,等等。

all of the styles go away, such as the touch animation, shadow, rounded corner, etc.

推荐答案

如果我理解正确的话,你想要做这样的事情:

If I understand you correctly, you want to do something like this:

在这种情况下,它应该是刚好够使用:

In such case, it should be just enough to use:

<item name="android:colorButtonNormal">#2196f3</item>

在除了使用材料主题教程

动画变种这里

这篇关于Android的材料设计按钮样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆