Reputation: 2376
Hello I have an issues as shown above. The problem I am facing is that there appears to be an invisible padding to the left of the radio button as listed above. My question is that is this due to a drawable issue with the radio or can I tweak an attribute to get it to align up with my text and input fields. If I need to use an alternate drawable, is there one I can get from the SDK with no margins / padding?
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
... stuff
<RadioGroup
android:layout_margin="0dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radio_free_busy"
android:checked="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="0dp"
android:text="@string/label_invitation_free_busy"
/>
<RadioButton
android:id="@+id/radio_free_busy_plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_invitation_free_busy_plus"
/>
<RadioButton
android:id="@+id/radio_none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/label_invitation_none"
/>
</RadioGroup>
</LinearLayout>
It seems to be due to the drawable ... if someone has an alternative would be helpful
Upvotes: 8
Views: 7616
Reputation: 151
add this in radio button xml
android:minWidth="0dp"
android:minHeight="0dp"
all extra padding will be remove. Then you can adjust the margin
Upvotes: 1
Reputation: 3456
You have right. I tried and I added a negative margin left.
This is the result :
This is what I did :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-3dp"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radio_free_busy"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:drawablePadding="0dp"
android:text="Free busy" />
<RadioButton
android:id="@+id/radio_free_busy_plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Invitation free busy plus" />
<RadioButton
android:id="@+id/radio_none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Invitation none" />
</RadioGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Whate name should people in this group see ?" />
Upvotes: 5