彩色图像变成没有颜色,只是可绘制的灰色矢量?
The colored image turned to have no color and just a grey vector in drawable?
我在 Drawable cus 中创建了一个新的图像资源,因为我需要在我的应用程序中插入一个新图像,但是每次我创建一个新的图像资源时,输出都变成没有颜色。我附上了它的照片。
这很令人困惑,每当我将它导入我的布局时,它都是灰色的,正如您在图像中看到的那样。为什么我找不到任何现成的解决方案?如果我被忽视了,请告诉我。
在可绘制文件夹中创建新资源时,您需要设置
"Launcher icons"
在
"Asset Type "
下拉
这将以原始颜色添加图像,并且不会变灰。它也有可能在 res/mipmap
文件夹中添加图像。您可以将图像从 mipmap
文件夹移动到您想要的任何位置。
我找到了我自己的问题的答案,我发现它对一些仍然不知道如何启用 Batch Drawable Import[=16 的人很有用=].这很容易,只需要下载插件并安装。我读到最新版本已经有了它,我已经下载并重新安装,但它并没有像我期望的那样显示。解决方案是下载并安装它。
First, In Android Studio, go to Default Setting File --> Setting or you can simple Click the SDK Manager Icon
In the Default Setting, go to Plugins
In the search option, type Batch Drawable Import and you'll see there's Android Drawable Importer.
In my image, it's already installed, Click Install Plugin and just follow the instructions.
You'll have to restart Android Studio and try to create a new Batch Drawable Import and you'll find it there. ;) Thanks.
当您在较新版本的 Android Studio(2.2) 中将图像资产创建为操作栏和选项卡图标时,它会自动转换为灰度,从下拉列表中选择主题默认为 HOLO LIGHT 选择自定义,您可以提供颜色代码,但这仅适用于草图和图像
To get color code
我找到了正确的解决方案!
您只需在创建 NavigationView 对象的地方添加此代码!
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
//add the line below and your icon will display as your .svg file
navigationView.setItemIconTintList(null);
navigationView.setNavigationItemSelectedListener(this);
我在 Drawable cus 中创建了一个新的图像资源,因为我需要在我的应用程序中插入一个新图像,但是每次我创建一个新的图像资源时,输出都变成没有颜色。我附上了它的照片。
这很令人困惑,每当我将它导入我的布局时,它都是灰色的,正如您在图像中看到的那样。为什么我找不到任何现成的解决方案?如果我被忽视了,请告诉我。
在可绘制文件夹中创建新资源时,您需要设置
"Launcher icons"
在
"Asset Type "
下拉
这将以原始颜色添加图像,并且不会变灰。它也有可能在 res/mipmap
文件夹中添加图像。您可以将图像从 mipmap
文件夹移动到您想要的任何位置。
我找到了我自己的问题的答案,我发现它对一些仍然不知道如何启用 Batch Drawable Import[=16 的人很有用=].这很容易,只需要下载插件并安装。我读到最新版本已经有了它,我已经下载并重新安装,但它并没有像我期望的那样显示。解决方案是下载并安装它。
First, In Android Studio, go to Default Setting File --> Setting or you can simple Click the SDK Manager Icon
In the Default Setting, go to Plugins
In the search option, type Batch Drawable Import and you'll see there's Android Drawable Importer.
In my image, it's already installed, Click Install Plugin and just follow the instructions.
You'll have to restart Android Studio and try to create a new Batch Drawable Import and you'll find it there. ;) Thanks.
当您在较新版本的 Android Studio(2.2) 中将图像资产创建为操作栏和选项卡图标时,它会自动转换为灰度,从下拉列表中选择主题默认为 HOLO LIGHT 选择自定义,您可以提供颜色代码,但这仅适用于草图和图像 To get color code
我找到了正确的解决方案! 您只需在创建 NavigationView 对象的地方添加此代码!
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
//add the line below and your icon will display as your .svg file
navigationView.setItemIconTintList(null);
navigationView.setNavigationItemSelectedListener(this);