【发布时间】:2021-12-28 19:14:36
【问题描述】:
我使用以下FloatingActionButton,并使用xml 设置了背景图像。如何在 Kotlin 中以编程方式更改图像?我想用 'image-bw' 替换图像 'image-color'。
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/image_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/image-color"
android:scaleType="center"
app:maxImageSize="56dp"
app:tint="@null"
app:layout_anchor="@id/bottom_appbar"
android:contentDescription="Categories" />
【问题讨论】:
标签: android kotlin floating-action-button material-components-android