猿问

radiogroup布局中的问题

<RelativeLayout 
        android:id="@+id/layout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        android:layout_alignParentBottom="true"
        >

        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="@string/content1" 
            android:layout_weight="1"
           android:drawableTop="@drawable/ic_launcher"
          android:gravity="center_horizontal"
            />

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/content2" 
            android:layout_weight="1"
            android:drawableTop="@drawable/ic_launcher"
            android:gravity="center_horizontal"/>

        <RadioButton
            android:id="@+id/radio2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/content3" 
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:drawableTop="@drawable/ic_launcher"
            />
        <RadioButton
            android:id="@+id/radio3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/content4" 
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:drawableTop="@drawable/ic_launcher"
           />
    </RadioGroup>

</RelativeLayout

这样底部能平均分部,但是,只要给每一个radiobutton加上   button=“@null”的属性后就会变成

http://img.mukewang.com/5743d887000113dd03430090.jpg

我想要它们能平均分部在底部。。!求大神指教!

qq_我很丑绝缘体_0
浏览 2397回答 2
2回答

蜂之谷

RadioGroup设置android:layout_width="match_parent"radiobutton设置android:layout_width="0dp"

addsion_y

才看到被采纳了,那我就不回答了
随时随地看视频慕课网APP

相关分类

Android
我要回答