I have following relative layout:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/relativeLayoutScrollableForCentering"
android:layout_below="@+id/addressOfProvider"
android:layout_centerHorizontal="true">
I want to change the attribute "layout_centerHorizontal" programmatically. How can I do that?
I'm not sure which layout parameters to set:
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
to achieve just what I want after getting the relative layout by using:
RelativeLayout relLayoutForCentering =
(RelativeLayout)view.findViewById(R.id.relativeLayoutScrollableForCentering);
?