gpt4 book ai didi

android - 我可以在 Android 快捷方式功能中为图标着色吗?

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:51:54 28 4
gpt4 key购买 nike

我有一个像这样的 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 StudioImage Asset 创建快捷方式图标(用于静态快捷方式)

或使用动态快捷方式并通过 drawable.setTint(tint) 以编程方式为它们着色。

关于android - 我可以在 Android 快捷方式功能中为图标着色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41997134/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com