开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜