how to center layout to vertical in android through java code?
Posted
by UMMA
on Stack Overflow
See other posts from Stack Overflow
or by UMMA
Published on 2010-06-16T13:54:53Z
Indexed on
2010/06/16
20:52 UTC
Read the original article
Hit count: 131
android
friends,
i want to set android:layout_centerVertical="true" property of layout through java code of an image.
can any one guide me how to achieve this. here is my code.
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
params.height = (int)totalHeight;
img.setLayoutParams(params);
i have tried using setScaleType(ScaleType.FIT_CENTER) but no use.
any help would be appriciated.
© Stack Overflow or respective owner