线性布局内的两个框架布局

dav*_*c97 3 android android-linearlayout android-framelayout

这是我现在的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@+id/tablet_locations_fragment_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <FrameLayout
        android:id="@+id/tablet_locations_fragment_locations_fragment_list_container"
        android:layout_width="match_parent"
        android:layout_height="90dp" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我认为很明显,我希望底部框架布局为90dp高和高,以占据剩余的空间,但目前,上部框架布局占据了所有的屏幕高度.我怎样才能解决这个问题?我试图将layout_height ="wrap_content"用于上部框架布局,但它没有改变任何东西.

lig*_*igi 10

layout_weight是你的朋友

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@+id/tablet_locations_fragment_fragment_container"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_height="0dp" />

    <FrameLayout
        android:id="@+id/tablet_locations_fragment_locations_fragment_list_container"
        android:layout_width="match_parent"
        android:layout_height="90dp" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)