Ala*_*ACK 8 android android-studio
默认的 Android 图像工作室只允许我选择 1 种颜色作为图标的背景。有没有办法选择2并创建线性渐变效果?
Jac*_*cky 12
在 drawable 中创建一个 color_gradient.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="@color/start_gradient" <!--Start color of the gradient-->
android:endColor="@color/end_gradient" <!--End color of the gradient-->
android:angle="45" /> <!--Change this to see the combination of gradient color-->
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
用于图像时:
android:backgroundTint="@drawable/color_gradient
Run Code Online (Sandbox Code Playgroud)
编辑:
在使用 Android Image Asset 的情况下,您仍然可以将背景颜色链接到此 xml 文件,以创建渐变背景
| 归档时间: |
|
| 查看次数: |
3786 次 |
| 最近记录: |