开发者

Proportionately re-sizing ImageView when width is set to fill parent

Is there a way to proportionally set the height of an ImageView if the width is set to android:layout_width="fill_parent"?

It appears there is no direct way of adjusting an ImageView without skewing one of it's dimensions. This seems 开发者_开发问答bizarre given the application is expected to support a slew of screen sizes and resolutions.


You can use wrap_content for the height and set the correct scale type (either in code or via the android:scaleType attribute in XML). You are probably looking for CENTER_INSIDE/android:scaleType="centerInside".

See ImageView.ScaleType

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜