【发布时间】:2022-01-08 11:03:23
【问题描述】:
我正在学习 android,想知道有没有办法将 FloatingActionButton 的填充颜色从黑色更改为白色。我使用的矢量资源也是白色填充色,但填充色仍然是黑色。我已经阅读了很多关于 FloatingActionButton 的文章和帖子,但都没有帮助我解决我的问题。
浮动操作按钮的xml代码
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
android:layout_marginBottom="30dp"
android:clickable="true"
android:tint="#ffffff"
app:backgroundTint="#3F51B5"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:rippleColor="#ffffff"
app:srcCompat="@drawable/ic_baseline_add_24"
android:focusable="true"
tools:ignore="VectorDrawableCompat" />
矢量素材
<vector android:alpha="0.74" android:height="24dp"
android:tint="#FFFFFF" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>
提前致谢
【问题讨论】:
标签: android xml floating-action-button