将视图放在两个具有严格尺寸的视图之间
Put view between two Views with strict size
有什么方法可以让我的 FrameLayout
介于 1.1 和 1.3 之间。
我尝试使用 layout_below
和 layout_above
,但它们不能一起工作。
1.RelativeLayout
1.1RelativeLayout
(strict_size)
1.2FrameLayout
(match_parent)
1.3RelativeLayout
(strict_size)
我会使用 LinearLayout
。假设你在谈论身高:
<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>
当这样使用layout_weight
时,LinearLayout
将首先布局固定尺寸的视图,然后将所有剩余的space分配给layout_weight="1"
视图。
有什么方法可以让我的 FrameLayout
介于 1.1 和 1.3 之间。
我尝试使用 layout_below
和 layout_above
,但它们不能一起工作。
1.RelativeLayout
1.1RelativeLayout
(strict_size)
1.2FrameLayout
(match_parent)
1.3RelativeLayout
(strict_size)
我会使用 LinearLayout
。假设你在谈论身高:
<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>
当这样使用layout_weight
时,LinearLayout
将首先布局固定尺寸的视图,然后将所有剩余的space分配给layout_weight="1"
视图。