0

在此处输入图像描述我正在处理一个项目,其中我必须做的是有两个列表并且布局非常大,您可以说它只是普通布局的两倍。我必须添加滚动视图以显示整个布局,但问题是如果我这样做,滚动视图中不能有列表,那么如果它是列表或滚动视图,编译器就会有歧义。现在我该怎么做才能帮助我提前谢谢...

我还附上了一张占我布局一半的图片....

在此处输入图像描述

4

1 回答 1

1

根据您的查询,我设计了一个示例 XML 文件:

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

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:background="#ffffff" >
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:background="#ffffeabc" >
        </LinearLayout>
    </LinearLayout>
</ScrollView>

在上面,您将拥有更大高度视图的滚动视图,并且您拥有相同比例的列表视图。你必须集中精力的事情android:layout_weight,你应该检查如何使用权重属性

编辑 :

好的,您可以做的一件事是,我们可以使用列表视图的页眉页脚概念-将 ImageView 和 2nd List View 作为第一个 List View 的页脚,以便 ImageView 和 2nd ListView 将始终低于 1st List View ..

对于页眉页脚概念,请检查此链接

于 2012-06-22T13:36:11.243 回答