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

标签 android shortcut

我有一个像这样的 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/

相关文章:

eclipse - 如何将 Intellij IDEA 键盘映射导入 Eclipse?

wix - 如何获得显示其 'normal' 图标的快捷方式?

php - 在 PHP 的一次调用中追加/连接多个字符串?

android - 图像不显示在使用 nativePath 的 flex 移动应用程序中

android - 使用 Volley 进行异步发布时抛出 OutOfMemoryError "pthread_create (1040KB stack) failed: Try again"

java - 在带有 proguard 的 Android 生产代码中使用 Hamcrest Matchers 时出现运行时错误

java - 如何启用 Collection notifyDataChange?

c# - string[] 的笛卡尔积与自身直接在 C# 中没有重复/克隆

inno-setup - 创建一个有两个文件名的快捷方式,一个是可变的?

android - 哪种文件上传协议(protocol) (FTP/HTTP) 适用于网络高度不可靠的移动设备