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

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

问题描述

标题很自我解释.

以下代码不会在浮动操作按钮下方呈现阴影.可以做什么来渲染阴影?API 21+ 真的不支持这个功能吗?

解决方案

只需设置 app:borderWidth="0dp" 即可为我解决此问题.

注意:不要忘记将 xmlns:app="http://schemas.android.com/apk/res-auto" 添加到您的根布局.

问题应在下一版 android 中修复设计库.

The title is pretty self explaining.

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

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

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

解决方案

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

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

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

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

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