小编gka*_*lis的帖子

如何将渐变可绘制设置为 FloatingActionButton 上的 backgroundTint 属性

我想为浮动操作按钮使用渐变色而不是传统的纯色。

我已经知道如何修改按钮的背景颜色,使用ColorStateList. 有没有办法将以下可绘制对象实现为背景色调?

覆盖文件

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">

    <gradient
        android:startColor="#c25f82"
        android:endColor="#5a3e60"
        android:angle="-270" />

</shape>
Run Code Online (Sandbox Code Playgroud)

android gradient background-color drawable floating-action-button

1
推荐指数
1
解决办法
4667
查看次数