ghostrider
ghostrider

Reputation: 5259

Setting an xml from one of my class

I want to create an xml file from my java class. How do I set the scaleType of my xml to fitXY programmatically? (I mean from another class, not in the xml file)

It should be something like this, but everything I try doesn't seem to work.

image.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

Upvotes: 1

Views: 63

Answers (1)

Padma Kumar
Padma Kumar

Reputation: 20041

//set like this

image.setScaleType(ScaleType.FIT_XY);

Upvotes: 1

Related Questions