Question

is there any method, property or xml tag for Android to stretch image like iOS?

for example:

UIImage *stretchableBackButton = [[UIImage imageNamed:@"back.png"] stretchableImageWithLeftCapWidth:6 topCapHeight:6];
[button setBackgroundImage:stretchableBackButton forState:UIControlStateNormal];

it stretches the image from 6 px to whole width/height.

thanks...

Was it helpful?

Solution

ok, i found it. it is Nine patch. there is no method or any xml tag. image file must be redrawn by draw9patch tool.

http://developer.android.com/tools/help/draw9patch.html http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

OTHER TIPS

You can do this code in xml imageView

android:scaleType="fitCenter" android:adjustViewBounds="true"

or you can use through program like this

imageview.setAdjustViewBounds(true);
imageview.setScaleType(ScaleType.FIT_XY);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top