ScrollView仅应用于LinearLayout子节点而不是LinearLayout本身

时间:2017-04-21 14:37:11

标签: android xml android-layout scrollview

我正在尝试制作一个scrollview,但它已经应用于我在LinearLayout,scrollview子项中的2个列表中。我希望能够在整个布局中垂直滚动,但它只允许我在列表上滚动。我做错了什么,可以修复吗?

提前致谢

content_habilitacoes.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.example.luis.trabindividual.HabilitacoesActivity"
    tools:showIn="@layout/app_bar_habilitacoes">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true">

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

                <TextView
                    android:id="@+id/content_habilitacoes_titulo_1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/content_habilitacoes_titulo_1"
                    style="@style/contentMainTitle"/>

                <ListView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/ListaHab1"/>

                <TextView
                    android:id="@+id/content_habilitacoes_titulo_2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/content_habilitacoes_titulo_2"
                    style="@style/contentMainTitle"/>

                <ListView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/ListaHab2"/>
            </LinearLayout>
       </ScrollView>
    </RelativeLayout>
</android.support.constraint.ConstraintLayout>

如何显示

enter image description here

0 个答案:

没有答案