安卓:2相对布局分为两半屏幕 [英] Android: 2 relative layout divided in half screen
本文介绍了安卓:2相对布局分为两半屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试过很多次吸取2相对布局在水平方向排列,并在半屏分。
I tried many times to draw 2 Relative layout aligned horizontally and divided in half screen.
我设计用油漆的形象来解释会好一点我的意思。
I design the image with paint to explain a bit better what i mean.
任何建议?
推荐答案
您可以把这些2 RelativeLayouts与水平方向一的LinearLayout内,然后使用的 重量为RelativeLayouts。这要分的LinearLayout在2等份。
You can put these 2 RelativeLayouts inside a LinearLayout with horizontal orientation, then use the weight for both RelativeLayouts. This will divide the LinearLayout in 2 equal parts.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
</RelativeLayout>
</LinearLayout>
这篇关于安卓:2相对布局分为两半屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文