When put images on drawable v24 app crashes , and use the same image
in drawable work correctly.
Look at which line your app is crashing in Logcat. You will be calling the resource file like this: R.drawable.yourresource. In this case it will work fine. If you change this line to R.drawableV24.yourresource and place the resource file in drawable V24 folder, it will work.
It all depends on how you identify the resource file :)
Please check your image drawable folder if the image in drawableV24 so transfer it in an only drawable folder and check it
Image resources placed in the res/drawable/ directory may be automatically optimized with lossless image compression by the aapt tool during the build process.
for more detail click here
Related
I have a png file named triedsohardicon.png I want to use for my app's launcher icon, but after putting it in the folder associated with the project, I find that Image Asset Studio doesn't show any triedsohardicon.png in its file system browser in that location.
In addition, if I put the line
android:icon="#drawable/triedsohardicon"
in AndroidManifest.xml (because I did in fact put the png file in the TriedSoHard/app/src/main/res/drawable folder), the text in quotes just returns the error "Cannot resolve symbol '#drawable/triedsohardicon'".
The png has dimensions 512x512. I could use some help, please.
Launcher Icon should be placed in mipmap res\mipmap\triedsohardicon.png
Place your launcher Icon through Image Asset like below:
Upload and Save the png and it will be placed in mipmap automatically.
In Maifest:
android:icon="#mipmap/triedsohardicon"
Hope this helps.
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.
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
In your XML remove file extension and replace . with _
android:src="#drawable/podcast_ac_new_2_9"
My ImageButton in my app is very tiny and cut off. I realized this could be because the image was in the drawable folder instead of the mitmap folders. So, I copied the images from the drawable folder, and pasted them in mitmap folders. Now, should I go about deleting the image from the drawable folder? I get the following saying it is not safe:
I know how to access the images, but should I delete them from the drawable folder now that I have already moved them to the mitmaps? If I do a delete anyway, will I need to alter my code to access the mitmap image? What is safest to do?
Here is an image of my mitmaps:
Thanks for the expert advice,
Rich
"Not safe" in this context just means that it's still being used somewhere. If you delete it, the current usage will fail to compile, and you'll be easily able to find and alter it to point at the new location.
You can safely delete this image, in Android Studio if you are using this image or else the file will be open at some place, you can get this error actually, so try deleting this image will safely remove the only selected image into your workspace. So hassle free to delete it.
After deleting your image, clear your project and run it, it works fine.
The mipmap folder is used for image that are very small and should be used in the action bar, and other menus. If you find your image too tiny, it just will be worst if you put it in the mipmap folder. If it's tiny although the image is in the drawable folder, maybe the image has a very small dimension or your imageview is too small.
I used the freely available Simple 9patch generator available online, to generate a logo for my app's splash screen.
But how do I place it in Android Studio drawable folder?
Do I have to make separate drawable folders like ldpi, hdpi etc?
I tried that but when I try to set the image on a layout, it gives me an error saying
Cannot resolve symbol #drawable/something
You need to make sure, you have place the images in the correct folder. Here's an example,
Original post: Add 9-patch image to Android Studio
Get rid of the .9 in #drawable/splash.9. It is just #drawable/splash. .9.png is the file extension, and file extensions are not used in references to resources.
I have this code:
android:drawable="#pickuptools.png"
the picture is called pickuptools.png and is inside the folder drawable-xhdpi.
I have tried #drawable-xhdpi/pickuptools.png, pickuptools without the file extension, and many more.
I can't find the picture through the XML.
The XML is located inside the drawable-xhdpi folder.
What am I doing wrong?
Use:
android:drawable="#drawable/picuptools"
You don't need to use #drawable-xhdpi or something. For any resources , you should use resource type(In your case its drawable) and name of the resource.
For further reference, check out this Android page on how to access Resources.