Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Radio Button left padding to 0

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

like image 544
user3547028 Avatar asked Feb 02 '26 23:02

user3547028


1 Answers

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 ?

like image 152
Vilen Avatar answered Feb 05 '26 14:02

Vilen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!