How do I stop proportional image scaling?

时间:2017-12-18 08:06:06

标签: java android image constraints scale

I want my image to increase in height and width when the constraints expand, but I don't want them to do so proportionally. If only the height constraint expand, then only the image height should change (I'm trying to do a graphic background that expand with text size).

I have looked at the different xml options, eg. android:scaleType="centerInside", etc, but none seem to work the way I want. Any ideas?

1 个答案:

答案 0 :(得分:1)

Use

[False]

as described in documentation:

fitXY Scale the image using FILL.

Scale in X and Y independently, so that src matches dst exactly. This may change the aspect ratio of the src.