我使用的是material components FloatingActionButton https://material.io/develop/android/components/floating-action-button/
在这种情况下,我无法为我的工厂添加高程我尝试使用以下代码,但它不工作app:elevation="12dp" app:borderWidth="0dp"
这是我的xml。
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/mfab"
style="@style/Widget.MaterialComponents.FloatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/mainlay"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="-28dp"
app:elevation="12dp"
app:borderWidth="0dp"
app:fabSize="normal"
app:srcCompat="@drawable/ic_directions_walk_white_18dp" />发布于 2019-04-13 22:03:42
AFAIK工厂替代高程值。因此有两种可能的解决方案: 1.获取fab的源代码并更改elevation的值2.创建自己的实现。我建议你使用第一种解决方案。
发布于 2019-04-17 21:41:08
您是否尝试过使用所需的标高定义从Widget.MaterialComponents.FloatingActionButton继承的自定义样式,并在FAB实例上设置该自定义样式?
https://stackoverflow.com/questions/55665831
复制相似问题