How to install android: orientation = "horizontally" programmatically in RelativeLayout?

How to configure android: orientation = "horizontally" programmatically in RelativeLayout like this:

<RelativeLayout
                android:id="@+id/ID"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

</RelativeLayout>

This is what I have so far:

RelativeLayout rLayout = new RelativeLayout(getActivity());
LayoutParams layoutParams;
layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
rLayout.setLayoutParams(layoutParams);
+4
source share
2 answers

As you can see in the docs , for RelativeLayoutno argument orientation.

+20
source

A Relative Layout RelativeLayout is not orientated. Maybe you need LinearLayout.

+3
source

All Articles