【问题标题】:Android support design floating action button elevation not visible for colors other than whiteAndroid 支持设计浮动操作按钮高度对于白色以外的颜色不可见
【发布时间】:2016-06-01 01:01:01
【问题描述】:

我正在使用 compile 'com.android.support:design:23.1.1'android.support.design.widget.FloatingActionButton 创建 FAB。

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

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

这是我的代码:

<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 中的按钮。

例如检查这个(阴影的方向向下):

我做错了什么?

【问题讨论】:

    标签: android android-support-design floating-action-button


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-09-07
      • 2019-01-16
      • 2016-01-07
      • 2015-03-15
      • 1970-01-01
      • 2015-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多