Here is the Layout
<FrameLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tab"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/panel1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:text="How much is 5 by 5?"
android:visibility="visible" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:id="@+id/radio_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="10" />
<RadioButton
android:id="@+id/radio_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="25" />
<RadioButton
android:id="@+id/radio_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="50" />
</RadioGroup>
</LinearLayout>
</FrameLayout>
What I need is: the EditBox is on top, and all radio buttons will share the rest of space below the EditText. For this I use android:layout_weight="1"
When Android App Layout manager loads this Layout from XML then the space is used by radios as expected.
When I build it from code using:
rb.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f));
It doesn't.. Radios are all nested upward, not spreaded inside the rest of space. Please, any idea why? And what am I doing wrong?
Thanks.