简体   繁体   English

ScrollView在FrameLayout中不起作用

[英]ScrollView is not working inside the FrameLayout

The Below is my code i am not able to scroll the layout looking weird when i put scrollview 下面是我的代码,当我放置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>

Inside ScrollView try to use LinearLayout instead of RelativeLayout . ScrollView内部,尝试使用LinearLayout而不是RelativeLayout

Something like this: 像这样:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM