繁体   English   中英

如何使LinearLayout(或任何其他布局)在右侧堆叠子级

[英]How to make LinearLayout (or any other layout) to stack childs on the right side

我在运行时向我的LinearLayout添加新视图。 我希望它们堆叠在布局的右侧。

图片时钟图标堆积在左侧,因此与我想要的相反。 是否可以使它们堆叠在隐藏的LinearLayout的右侧? (它可以是任何其他布局,如果可以提供我想要的,则不仅可以是线性布局)

在此处输入图片说明

像这样吗

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

蓝线是所选的线性布局:

蓝线是所选的线性布局

暂无
暂无

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

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