我有一个像这样的 Android xml shortcut特点:
<shortcuts
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="some_id"
android:enabled="true"
android:icon="@drawable/ic_icon"
android:shortcutShortLabel="@string/short_label"
android:shortcutLongLabel="@string/long_label"
tools:targetApi="n_mr1">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="my.package"
android:targetClass="my.package.MainActivity" />
</shortcut>
</shortcuts>
目前我的图标是一个矢量可绘制对象,它有白色调。
我能以某种方式在文件定义中使用不同的色调吗?所以像这样:
<shortcut
...
android:icon="@drawable/ic_icon"
android:iconTint="#0000ff"
...>
</shortcut>
最佳答案
既没有 android:tint="color"
也没有 android:iconTint="color"
。
您可以使用 Android Studio 的 Image Asset 创建快捷方式图标(用于静态快捷方式)
或使用动态快捷方式并通过 drawable.setTint(tint)
以编程方式为它们着色。
关于android - 我可以在 Android 快捷方式功能中为图标着色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41997134/