2016-02-19 28 views
6

我正在使用compile 'com.android.support:design:23.1.1'android.support.design.widget.FloatingActionButton创建FAB。Android支持设计浮动动作按钮标高对于白色以外的颜色不可见

当背景色调为白色时,海拔(阴影)非常明显。

enter image description here

但是对于其他颜色不海拔可见。

enter image description here

这里是我的代码:

<android.support.design.widget.FloatingActionButton 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/create_floating_button" 
     app:elevation="6dp" 
     app:borderWidth="0dp" 
     android:clickable="true" 
     app:backgroundTint="@color/colorAccent" 
     app:rippleColor="@color/colorAccentLight" 
     android:layout_margin="10dp" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 

除了这个问题,即使有白色,按钮似乎并不像在google material design spec的人。

检查此例如(影子的方向是向下):

enter image description here

我在做什么错?

回答

0

确保您有一个特定的layout-v21文件,您可以用android:elevation替换app:elevation。在API 21之后,您需要这样做以保持良好的兼容性。