0
我在运行时向我的LinearLayout添加新视图。我想让它们堆叠在布局的右侧。如何使LinearLayout(或任何其他布局)在右侧堆叠孩子
在图片上,时钟图标堆叠在左侧,所以它与我想要的相反。是否有可能使它们堆叠在higlited LinearLayout的右侧? (它可以是任何其他的布局,不只是线性的,如果它给了我想要的东西)
我在运行时向我的LinearLayout添加新视图。我想让它们堆叠在布局的右侧。如何使LinearLayout(或任何其他布局)在右侧堆叠孩子
在图片上,时钟图标堆叠在左侧,所以它与我想要的相反。是否有可能使它们堆叠在higlited 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>
蓝线是线性布局选择:
我只是想知道为什么我永远无法得到这个工作 –
你为什么不只是使用一个'ActionBar'? – Eric
'LinerLayout'不堆叠(如在另一个之上)它的孩子。你需要一个'RelativeLayout'或者'FrameLayout'。 – Luksprog
尝试将LinearLayout的重力设置为right_climateLayout.setGravity(Gravity.RIGHT);' –