溫馨提示×

Android按鈕間距怎么設置

小億
505
2023-08-15 21:02:47
欄目: 編程語言

您可以使用android:layout_margin屬性來設置Android按鈕之間的間距。

例如,以下是一個按鈕布局,其中包含兩個按鈕,它們之間有10dp的間距:

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕1"
android:layout_marginEnd="10dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按鈕2"/>
</LinearLayout>

在這個例子中,通過在第一個按鈕上設置android:layout_marginEnd="10dp",在按鈕之間創建了10dp的間距。您可以根據需要調整間距的大小。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女