[英]Put view between two Views with strict size
Is there any way to put my FrameLayout
between 1.1 and 1.3. 有什么办法可以将我的
FrameLayout
放在1.1和1.3之间。 I tried to use layout_below
and layout_above
for it, but it doesn't work together. 我尝试使用
layout_below
和layout_above
,但无法同时使用。
1. RelativeLayout
1.
RelativeLayout
1.1 RelativeLayout
(strict_size) 1.1
RelativeLayout
(strict_size)
1.2 FrameLayout
(match_parent) 1.2
FrameLayout
(match_parent)
1.3 RelativeLayout
(strict_size) 1.3
RelativeLayout
(strict_size)
I would use a LinearLayout
. 我会使用
LinearLayout
。 Assuming you are talking about heights: 假设您在谈论高度:
<LinearLayout
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp">
</LinearLayout>
When using layout_weight
like that, LinearLayout
will first lay out views with fixed dimensions, and then assign all the remaining space to the layout_weight="1"
view. 像这样使用
layout_weight
, LinearLayout
将首先对具有固定尺寸的视图进行布局,然后将所有剩余空间分配给layout_weight="1"
视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.