Android material design buttons - Pre lollipop

2019-03-07 13:23发布

How do I implement the "raised button" and the "flat button" as described in google's material design guidelines?


Raised buttons add dimension to mostly flat layouts. They emphasize > functions on busy or wide spaces.

raised buttons


Use flat buttons for toolbars and dialogs to avoid excessive layering.

flat buttons

Source: http://www.google.com/design/spec/components/buttons.html

8条回答
聊天终结者
2楼-- · 2019-03-07 14:12

You can use MaterialDesignLibrary. It's third party library.

This is a library with components of Android L to you use in android 2.2 If you want use this library, you only have to download MaterialDesign project, import it into your workspace and add the project as a library in your android project settings.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-07 14:16

You may also need to add a bottom margin to your button, in order to be able to see the raised-button shadow effect:

<item name="android:layout_marginBottom">@dimen/activity_vertical_margin</item>
<item name="android:elevation">1dp</item>
查看更多
登录 后发表回答