How do I center align Radio button inside LinearLayout
For the TextViews:
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1.4">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:padding="2dp"
android:textColor="#000000"
android:text="Often"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:textColor="#000000"
android:paddingRight="5dp"
android:paddingLeft="2dp"
android:text="Sometimes"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#000000"
android:padding="2dp"
android:text="Rarely"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:textColor="#000000"
android:text="Never"
/>
</LinearLayout>
For the RadioButtons:
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1.4">
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:padding="2dp"
/>
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:paddingRight="5dp"
android:paddingLeft="2dp"
android:layout_gravity="center"
/>
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:padding="2dp"
/>
<RadioButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
/>
</LinearLayout>
This is still it looks like :
May I know where i am doing mistake, I already tried with layout_gravity = "center"
and gravity = "center"
How can i align it to Center, where i have to make change ?
If I understand correctly what you want to do..i suggest you the below layout..