如何添加阴影所提供的支持Android的设计库中的FAB? [英] How to add shadow to the FAB provided with the android support design library?

查看:443
本文介绍了如何添加阴影所提供的支持Android的设计库中的FAB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是pretty的自我解释。

The title is pretty self explaining.

下面code不渲染阴影之下浮动操作按钮。可以做些什么来渲染阴影?难道这个功能真的不支持甚至在API 21 +?

The following code does not render shadow below the Floating Action Button. What can be done to render shadow? Is this feature really not supported even on API 21+?

<android.support.design.widget.FloatingActionButton
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:src="@drawable/ic_add"
    android:clickable="true" />

请注意:添加机器人:海拔不能在API 21添加阴影

Note: Adding android:elevation does not add shadow on API 21.

截图通过dandar3从实例采取: <一href="https://github.com/dandar3/android-support-design">https://github.com/dandar3/android-support-design

Screenshot taken from the example by dandar3: https://github.com/dandar3/android-support-design

推荐答案

简单的设置应用程序:边框宽度=0dp解决这个问题对我来说

Simply setting app:borderWidth="0dp" resolve this issues for me.

注意:不要忘了添加的xmlns:程序=htt​​p://schemas.android.com/apk/res-auto你的根布局。

Note: don't forget to add xmlns:app="http://schemas.android.com/apk/res-auto" to your root layout.

应固定在Android的设计库的下一次发布此问题。

This issue should be fixed in next release of android design library.

这篇关于如何添加阴影所提供的支持Android的设计库中的FAB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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