请用安卓RadioGroup在xml文件中写一个竖着排列的按钮组且界面美观
以下是一个简单的竖着排列的RadioGroup按钮组的例子:
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_gravity="center_horizontal">
<RadioButton
android:id="@+id/radio_button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton 1"
android:textSize="16sp"/>
<RadioButton
android:id="@+id/radio_button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton 2"
android:textSize="16sp"/>
<RadioButton
android:id="@+id/radio_button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton 3"
android:textSize="16sp"/>
</RadioGroup>
这个例子使用了一个竖向的RadioGroup布局,并且设置了每个RadioButton的文本和字体大小。还添加了一些上下的边距和水平居中的布局。您可以根据自己的需求调整这些属性以实现您所需的外观
原文地址: https://www.cveoy.top/t/topic/hpyw 著作权归作者所有。请勿转载和采集!