android

Android按钮间距怎么设置

小亿
470
2023-08-15 21:02:47
栏目: 编程语言
Android开发服务器,限时0元免费领! 查看>>

您可以使用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的间距。您可以根据需要调整间距的大小。

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关推荐:Android spinner如何设置选项间距

0
看了该问题的人还看了