Working in android studio. I'm importing an image into an imageview but as I test my app across different devices the images becomes a bit distored. I'm assuming this is because of different resolution/size of the devices. Is there anyway to maintain the same image size across all of the different android devices? Thank you.
Asked
Active
Viewed 63 times
0
-
Are you following android folder structure for drawable,http://developer.android.com/guide/practices/screens_support.html – Piyush Jan 21 '16 at 15:25
-
Take a look at this answer http://stackoverflow.com/questions/12059328/android-imageview-fit-width/15786900#15786900 - You can use scaleType with different values to get require ImageView – Sharjeel Jan 21 '16 at 15:30
2 Answers
0
First of all your image size must be larger than you're trying to support device(s). If your image is in app resources, you can resize it for hdpi, mdpi, xhdpi, xxhdpi, etc. and if the range is not suitable for the screen(s), you can crop in center or something like that. But if you get this image from a URL, you had better do this with Retrofit that does caching and background task.

halilkaya
- 467
- 6
- 21
0
Set to your ImageView android:scaleType="centerCrop"
. That should solve your problem.

Gueorgui Obregon
- 5,077
- 3
- 33
- 57