gpt4 book ai didi

android - 如何在垂直方向的android单选按钮之间提供间距

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:23 25 4
gpt4 key购买 nike

我有一个场景,我需要在垂直排列的单选按钮之间提供间距。
下面是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingStart="20dp"
android:paddingRight="20dp"
android:paddingEnd="20dp"
>
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="My text view"
android:textSize="20dp"
android:textColor="#000000"
android:gravity="center_vertical"
android:background="@drawable/roundedlabel"
/>
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="152dp"
android:layout_height="wrap_content"
android:paddingTop="10dp"
>
<RadioButton
android:id="@+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text view1"
android:textSize="20dp"
android:paddingTop="10dp"
/>
<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="text view2"
/>
<RadioButton
android:id="@+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="text view3"
/>
<RadioButton
android:id="@+id/radio3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="text v4iew"
/>
</RadioGroup>
</LinearLayout>

我尝试为每个将文本置于底部的单选按钮放置 android:paddingTop="10dp",但单选按钮保持在同一位置。
任何人都可以帮助我如何提供垂直方向排列的单选按钮之间的间距吗?

最佳答案

尝试使用layout_margin 属性,它的工作原理与填充类似,但可能会达到您想要的效果。您可以简单地使用 android:layout_margin="20dp"或者您可以设置单独的边,就像您可以设置填充一样(例如:android:layout_marginLeft="20dp")。

关于android - 如何在垂直方向的android单选按钮之间提供间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30175860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com