Importing image into Android Studio, appears as dark grey

[亡魂溺海] 提交于 2020-01-01 16:56:09

问题


I am attempting to import an image into Android Studio and then use it as a background for my app. I right click on the res folder and import asset, next I choose action bar and tab icons, here I find the image file on my pc and then import it in my project.

When It imports all the previews are dark grey and then when I place it in my layout I get this:

I am using a PNG which is around 700kb if that makes any difference.


回答1:


I did a variety of things and not sure which one fixed the issue.

First I realised my project wasn't using the gradle wrapper which was causing issues, to fix this I went to file->settings and told Intellij to use the default gradle wrapper.

I then installed the Android Drawable Importer plugin and imported my images with this, works fine now.




回答2:


Right Click on drawable-> navigate to -> New -> Batch Drawable Import-> fClick on the + sign. Choose your image and click OK. It will create the images with different density.

For enabling the Android Drawable Importer plugin you can refer this link http://www.javahelps.com/2015/02/android-drawable-importer.html




回答3:


Try this > In android studio go to the file menu and click, Invalidate Caches / Restart



来源:https://stackoverflow.com/questions/37302854/importing-image-into-android-studio-appears-as-dark-grey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!