Android - Autofit image in ImageView?
I will be displaying an image in an ImageView that will always be much higher and wider than the size of the screen. Is there a simple way to scale the image down so that it f开发者_开发技巧ills the ImageView exactly?
Try setting up the scale type in the xml, i believe it scaleXY is the one you are looking for scale types
<ImageView
android:scaleType="scaleXY"
android:src="@drawable/my_image"/>
If you're loading the view in XML, the android:scaleType parameter should do the trick.
http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType
精彩评论