Android ScrollView在FrameLayout中不起作用

Android ScrollView在FrameLayout中不起作用,android,Android,下面是我的代码,当我放置scrollview <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:backgrou

下面是我的代码,当我放置
scrollview

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cc"
    tools:context="willapp.stpl.com.willapp.util.ActivityPrintView">
    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fillViewport="true"

        android:orientation="horizontal">



    <!-- The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc. -->

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/rootLayout">


        <LinearLayout
            android:id="@+id/table1heading"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Select executer's relationship"
                android:id="@+id/txtHeading"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="5dp"
            android:id="@+id/mainactivity_layoutName"
            android:layout_below="@+id/table1heading"
            android:layout_centerVertical="true" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/mainactivity_txtLabelName"
                android:text="Full Name:"/>

            <View
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1">

            </View>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/mainactivity_txtValueName"
                android:text="Sssdadaad"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:id="@+id/mainactivity_layoutLine1"
            android:padding="5dp"
            android:layout_below="@+id/mainactivity_layoutName"
            android:layout_centerVertical="true" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/mainactivity_txtLabelLine1"
                android:text="Address Line1:"/>

            <View
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1">

            </View>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/mainactivity_txtValueLine1"
                android:text="Sssdadaad"/>

        </LinearLayout>





        </RelativeLayout>
</ScrollView>



</FrameLayout>

内部
滚动视图
尝试使用
线性布局
而不是
相对布局

大概是这样的:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cc"
    tools:context="willapp.stpl.com.willapp.util.ActivityPrintView">
    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:fillViewport="true"

        android:orientation="horizontal">


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

       // and here your main Relative layout

       </LinearLayout>

    </ScrollView>
</FrameLayout>

//这里是你的主要相对布局

如果问题更具描述性,则会有所帮助。请更改RelativeLayout width以包装内容,然后尝试为什么不能使用RelativeLayout?它可以工作,但单击侦听器不适用于相对布局内的视图。你知道怎么解决这个问题吗?