Why android resizes image?
I'm trying to change my application data source to the sdcard so that it doesn't take too much internal memory.
However, I had an I开发者_StackOverflowmage that was dynamically loaded from the resource and displayed in an ImageView, now I load the image from the sdcard whenever I need it.
I had been using imageBox.setImageResource(imageID)
and I changed to imageBox.setImageDrawable(imageDrawable)
.
The problem is that now Android resizes my image and it doesn't fit where it should. Why is it resizing the image this way? And how can I stop it?
Thanks in advance :)
Add the tag android:scaleType="fitXY"
to your ImageView's layout XML.
Ex.
<ImageView
... several settings ...
android:scaleType="fitXY"/>
Edit:
If your image is simply too big to fit inside the ImageView - it will have to do some kind of scaling. There are some other options as described in the API:
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Try the following for ImageView:
android:layout_height="fill_parent"
android:layout_width="fill_parent"
No Scale Type.
The ImageView Should be within Fixed Size (in dp) Parent View.
精彩评论