如何添加阴影到FAB提供的Android支持设计库?(How to add shadow to the FAB provided with the android support design lib

编程入门 行业动态 更新时间:2024-10-25 04:19:19
如何添加阴影到FAB提供的Android支持设计库?(How to add shadow to the FAB provided with the android support design library?)

标题是很自我解释的。

以下代码不会在“浮动操作”按钮下面显示阴影。 可以做什么来渲染阴影? 这个功能真的不支持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" />

注意:添加android:elevation不会在API 21上添加阴影。

从dandar3的示例中截取的屏幕截图: https : //github.com/dandar3/android-support-design

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

最满意答案

只需设置app:borderWidth="0dp"解决这个问题。

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

这个问题应该在下次发布的Android设计库中解决。

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.

更多推荐

API,android,shadow,dandar,阴影,电脑培训,计算机培训,IT培训"/> <meta name="

本文发布于:2023-04-28 02:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329821.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阴影   Android   add   shadow   FAB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!