Reputation: 143
I have an image with resolution 300x450. I want to use it on an Android Studio app. When I create a new "Image Asset", the pic looses its resolution, and if I select manually the resolution at the ImageView, it pixels.
What can I try?
Thank you
Upvotes: 2
Views: 9532
Reputation: 1
Just use scalable option in properties menu. in that select fitXY option and adjust your coordinates with height and width properties
Upvotes: 0
Reputation: 143
Fixed. The problem is, that you mustn´t to insert it as "Image Asset", you just have to drag the pic, to the Drawable/xhdpi folder. Then, you can to use it, with no problems.
Upvotes: 3
Reputation: 136
The image size you are using should have the resolution for the highest density (xxxhdpi) beacause when you create a new Image Asset, Android Studio create N different drawables for that image, one for each density, using the one you have as the "xxxhdpi one".
For example, let's say that image 300x450 is for a xhdpi screen. When you use that tool to create Image Asset, Android Studio will create a xxxhdpi asset 300x450, a xxhdpi 225x337, a xhdpi 150x225, and so on... And you try to use that xhdpi 150x225, in the same place you should use 300x450, and it pixels.
So, my solution, if you don't have the highest to generate the other ones, you should put that one directly in "xhdpi" (or the one it is designed for), and you can be sure that at least all density or lower than that, will be OK.
Upvotes: 2