Android 可滚动列表视图和文本视图

Android 可滚动列表视图和文本视图,android,android-layout,android-xml,Android,Android Layout,Android Xml,我对安卓布局文件有点困惑。 我不想得到的是: 记住ListView区域是可滚动的,但是无论列表有多长,TextView都应该在屏幕上始终可见 我尝试了几种方法,最后一种是: <LinearLayout> <LinearLayout> <ListView> </LinearLayout> <LinearLayout> <TextView> </LinearLayout>

我对安卓布局文件有点困惑。 我不想得到的是:

记住ListView区域是可滚动的,但是无论列表有多长,TextView都应该在屏幕上始终可见

我尝试了几种方法,最后一种是:

<LinearLayout>

  <LinearLayout>
     <ListView>
  </LinearLayout>

  <LinearLayout>
     <TextView>
  </LinearLayout>

</LinearLayout>

我不能让它正常工作。也许我的方法不对,或者只是设置不对?
如果我的方法正确,我将上传整个xml代码,这是设置的问题

使用相对布局作为容器

这是布局图

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

    <LinearLayout android:id="@+id/row1" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentBottom="true">
        <TextView android:text="This is bottom text"
            android:layout_height="wrap_content" android:layout_width="fill_parent"></TextView>
    </LinearLayout>
    <LinearLayout android:layout_above="@id/row1"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <ListView android:layout_width="fill_parent"
            android:layout_height="fill_parent"></ListView>
    </LinearLayout>



</RelativeLayout>

使用相对布局作为容器

这是布局图

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

    <LinearLayout android:id="@+id/row1" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentBottom="true">
        <TextView android:text="This is bottom text"
            android:layout_height="wrap_content" android:layout_width="fill_parent"></TextView>
    </LinearLayout>
    <LinearLayout android:layout_above="@id/row1"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <ListView android:layout_width="fill_parent"
            android:layout_height="fill_parent"></ListView>
    </LinearLayout>



</RelativeLayout>

使用以下布局可以帮助您

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<ListView
    android:id="@+id/listView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="50dp" >
</ListView>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="TextView" />

 </RelativeLayout>

使用以下布局可以帮助您

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<ListView
    android:id="@+id/listView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="50dp" >
</ListView>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="TextView" />

 </RelativeLayout>

试试这个

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

    <TextView
        android:id="@+id/textView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="TextView"
        android:gravity="center_horizontal"
        android:textSize="30sp" />

    <ListView
        android:id="@+id/myList"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/textView" >
    </ListView>

</RelativeLayout>

输出

试试这个

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

    <TextView
        android:id="@+id/textView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="TextView"
        android:gravity="center_horizontal"
        android:textSize="30sp" />

    <ListView
        android:id="@+id/myList"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/textView" >
    </ListView>

</RelativeLayout>

输出


我还没做那件事。文件说它应该做到这一点。我稍后会检查它,如果它还没有完成,我会接受答案。文件说它应该做到这一点。我稍后会检查并接受答案,如果它有效的话。你有解决方案还是你想要?你有解决方案还是你想要?哇,这就是我所说的答案。谢谢!:)哇,这就是我所说的答案。谢谢!:)