Android按钮间距怎么设置
lewis
2018-12-12
20次阅读
您可以使用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的间距。您可以根据需要调整间距的大小。

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