Android单选按钮:删除左边距

adr*_*ian 7 android

在此输入图像描述

你好,我有一个如上所示的问题.我面临的问题是,如上所列,单选按钮的左侧似乎有一个看不见的填充.我的问题是,这是由于收音机的可绘制问题,或者我可以调整属性以使其与我的文本和输入字段对齐.如果我需要使用备用drawable,我可以从SDK获得没有边距/填充吗?

<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>
Run Code Online (Sandbox Code Playgroud)

这似乎是由于可吸引人的......如果有人有替代方案会有所帮助

Far*_*uzi 5

你有权利。我尝试了一下,添加了负边距。

这是结果:

在此输入图像描述

这就是我所做的:

<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 ?" />
Run Code Online (Sandbox Code Playgroud)