在Android中,您可以使用layout_margin属性来调整Button的边距
打开XML布局文件,找到Button控件。
使用android:layout_margin属性为Button设置边距。例如:
<Button
android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点击我"
android:layout_margin="10dp" />
在这个例子中,android:layout_margin="10dp"为Button设置了10dp的上、下、左、右边距。
android:layout_marginTop:设置上边距android:layout_marginBottom:设置下边距android:layout_marginLeft:设置左边距android:layout_marginRight:设置右边距例如:
<Button
android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点击我"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
在这个例子中,我们分别设置了Button的上边距为10dp,下边距为10dp,左边距为20dp,右边距为20dp。