how to center layout to vertical in android through java code?
- by UMMA
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.