android两个线性布局高度比

android两个线性布局高度比,android,android-listview,android-linearlayout,Android,Android Listview,Android Linearlayout,我在一个xml文件中有两个线性布局,一个包含文本视图,后跟列表视图。下一个布局应显示在列表视图的下方,列表视图将listview中所选项目的描述显示为textview。这可能吗?下面的代码不显示TextView01。如果用这种简单的方法做不到的话,我还能用什么方法来做呢 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.co

我在一个xml文件中有两个线性布局,一个包含文本视图,后跟列表视图。下一个布局应显示在列表视图的下方,列表视图将listview中所选项目的描述显示为textview。这可能吗?下面的代码不显示
TextView01
。如果用这种简单的方法做不到的话,我还能用什么方法来做呢

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF88334C"
android:orientation="vertical"
>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="20dp"
    android:layout_marginTop="20dp"
    android:text="@string/hello_world"
    android:textColor="#FFAABBFF" />

<ListView
    android:id="@android:id/list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="48dp" >
</ListView>
<LinearLayout 

android:id="@+id/LinearLayou"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF88334C"
android:orientation="vertical"
>

<TextView
    android:id="@+id/TextView01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/byebye_world"
    android:textColor="#FFAEEEFF" />
</LinearLayout>

</LinearLayout>

您需要为此使用布局权重属性。试试这个布局

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF88334C"
android:orientation="vertical"
>

<LinearLayout 

android:id="@+id/LinearLayou"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF88334C"
android:orientation="vertical"
android:layout_weight="1"
>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="20dp"
    android:layout_marginTop="20dp"
    android:text="@string/hello_world"
    android:textColor="#FFAABBFF" />

<ListView
    android:id="@android:id/list"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="48dp" >
</ListView>
</LinearLayout>

<LinearLayout 

android:id="@+id/LinearLayou"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF88334C"
android:orientation="vertical"
android:layout_weight="2"
>

<TextView
    android:id="@+id/TextView01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/byebye_world"
    android:textColor="#FFAEEEFF" />
</LinearLayout>

</LinearLayout>

尝试以下代码:-

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FF88334C"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="hello_world"
        android:textColor="#FFAABBFF" />

    <ListView
        android:id="@android:id/list"
        android:layout_below="@+id/textView1"
        anndroi:layout_above="@+id/LinearLayou"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
              >
    </ListView>

    <LinearLayout
        android:id="@+id/LinearLayou"
               android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#FF88334C"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:orientation="vertical" >

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="byebye_world"
        android:textColor="#FFAEEEFF" />
    </LinearLayout>

</RelativeLayout>


使用父级相对布局并设置子级在相对布局中的位置。将alignParentTop trur用于textView,然后将layout_用于listview,并将alignParentBottom true用于最后一个textView。然后选中该复选框。这不会显示
TextView01
的内容。我正在测试它的中型(