Reputation: 179
Need help with radio button
My xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
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:orientation="horizontal" >
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:minWidth="0dp"
android:text="Hello" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:text="World" />
</RadioGroup>
</LinearLayout>
There is this space on the left between the circle and the left side of the linear layout. How do I get rid of that space? In TextViews setting minWidth to 0dp does the trick but I could not do it for RadioButtons. ANy ideas
Upvotes: 3
Views: 5827
Reputation: 2677
I think that what you wants is something like this
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-5dp"
android:text="Hello" />
and you dont need
android:layout_marginStart="0dp"
android:minWidth="0dp"
You can play with
android:layout_margin
until you get what you want.
You can get more information about margin attributes here
I hope this helps you!
Upvotes: 0
Reputation: 5061
there are few ways to do it, you can try this
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="-10dp"
>
... android:layout_marginLeft="-10dp"
does it do what you need ?
Upvotes: 2