Linux 拨号vps windows公众号手机端

Android按钮间距怎么设置

lewis 7年前 (2018-12-12) 阅读数 13 #程序编程
文章标签 android

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

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门