Narain Ramjieawan Narain Ramjieawan - 24 days ago 14
Android Question

Trouble with adding image source in android studio

I am trying to add a source image to an ImageView in Android Studio. I placed the image in the res/drawable folder. I have the same image placed in mdpi,hdpi,xhdpi,xxhdpi,and xxxhdpi.

However when I try to add the path to the image in xml it does not even show up. I have attached a screenshot of what I have.

Also I tried to clean and rebuild the project and still I cannot access the images in the drawable folder.

I should add that if I try and add the images to the mipmap folders. It works just fine and I can set the path of the images to mipmap.

drawable folders in android studio

Answer

You created the extra drawables folders inside of the main drawable folder instead of using the existing folders in the res/ directory. (See the mipmap folders?)

Also, don't need png extension in the XML, just the filename

Comments