我的Android快捷方式功能具有这样的xml :
<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的图片素材资源创建快捷方式图标(用于静态快捷方式)
或使用动态快捷方式并通过编程设置其色调drawable.setTint(tint)
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句