繁体   English   中英

如何制作组按钮?

[英]How to make group button?

我有3个按钮。 问题是我无法在布局中心放置3个按钮。 当我将手机水平放置时,问题将显示,按钮将显示在布局左侧不在中心。

您需要在线性布局中嵌入相对布局。 类似于下面显示的内容。 如果维护LinearLayout,这应该允许您获得可以更好地操作的组中的按钮。 另一件事是你有横向布局的单独布局吗?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal" >

    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <Button 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>


</RelativeLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM