Android 在滚动视图中放置选项卡布局和viewpager时,滚动视图滚动不顺畅?

Android 在滚动视图中放置选项卡布局和viewpager时,滚动视图滚动不顺畅?,android,android-scrollview,Android,Android Scrollview,我面临的问题是,当标签导航被放置在滚动视图中时,滚动视图不能顺利滚动。 下面的代码是xml文件,其中选项卡导航位于滚动视图中。我不知道这个问题发生的原因。请帮我解决这个问题 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.

我面临的问题是,当标签导航被放置在滚动视图中时,滚动视图不能顺利滚动。 下面的代码是xml文件,其中选项卡导航位于滚动视图中。我不知道这个问题发生的原因。请帮我解决这个问题

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_interview_scam"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.zcodia.scamlookup.Activities.ScamDetailsActivity">


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

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="180dp"
            android:foregroundGravity="center"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:id="@+id/profile_image"
            android:background="@mipmap/bg_splash_cut"
            android:src="@drawable/icon1"
            />

        <TextView
            android:text=""
            android:textSize="20dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:layout_marginBottom="8dp"
            android:id="@+id/subCategoryTitle"
            android:layout_above="@+id/textView11"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:textColor="#000000"/>

        <TextView
            android:text="Item ID:"
            android:textSize="15dp"
            android:textColor="#000000"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textView11"
            android:layout_alignBottom="@+id/profile_image"
            android:layout_marginLeft="15dp"
            android:layout_marginBottom="13dp" />

        <TextView
            android:text=""
            android:textSize="15dp"
            android:textColor="#000000"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/scamId"
            android:layout_alignBottom="@+id/profile_image"
            android:layout_marginLeft="75dp"
            android:layout_marginBottom="13dp" />

        <TextView
            android:text="@string/arrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_marginTop="19dp"
            android:layout_marginLeft="10dp"
            android:id="@+id/arrow_id"
            android:textColor="#FFFFFF"
            android:textSize="20dp"/>


    </RelativeLayout>


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
       >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="#FAFAFA"
            android:focusableInTouchMode="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:id="@+id/linearLayout4"
                android:layout_below="@+id/profile_image"
                android:layout_alignParentStart="true"
                android:layout_alignParentLeft="true"


                >

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/relative_layout_1"
                    android:background="#FFFFFF">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:text="No Of Cases Reported"
                        android:layout_marginLeft="15dp"
                        android:textSize="14dp"
                        android:id="@+id/report_cases_id"
                        android:gravity="center"/>

                    <TextView

                        android:textSize="14dp"
                        android:textColor="#EF5350"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/scam_report_count"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="10dp"
                        android:layout_marginTop="12dp"
                        />



                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FAFAFA">


                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:text="Report Loss"
                        android:textSize="14dp"
                        android:paddingLeft="15dp"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentLeft="true"
                        android:id="@+id/report_loss_id"
                        android:gravity="center"


                        />
                    <TextView
                        android:textSize="14dp"
                        android:textColor="#EF5350"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/loos_id"
                        android:layout_marginRight="10dp"
                        android:paddingTop="12dp"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"/>

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#FFFFFF"
                    >

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="40dp"
                        android:text="Possible Scammer Location"
                        android:textSize="14dp"
                        android:paddingLeft="15dp"
                        android:gravity="center"
                        android:id="@+id/possible_scammer_location_id" />

                    <TextView
                        android:layout_width="150dp"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"
                        android:textSize="14dp"
                        android:textColor="#EF5350"
                        android:paddingTop="12dp"
                        android:layout_marginRight="10dp"
                        android:id="@+id/scam_location"
                        android:ellipsize="end"/>

                </RelativeLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:background="#FAFAFA"

                    android:orientation="horizontal"
                   >

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="40dp"
                        android:text="Target Medium"
                        android:textSize="14dp"
                       android:paddingTop="10dp"
                        android:layout_weight="1"
                        android:layout_marginLeft="10dp"

                        />


                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="horizontal"
                        android:layout_marginRight="0dp"
                        android:id="@+id/scam_medium_linear">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/scam_medium_icon"
                        android:textSize="20dp"
                        android:layout_gravity="center"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="10dp"
                        android:layout_marginTop="3dp"
                        android:textColor="#EF5350"
                        />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:id="@+id/scam_medium_text"
                        android:textColor="#EF5350"
                        android:layout_marginTop="10dp"
                        android:layout_marginLeft="0dp"
                        android:layout_alignParentRight="true"
                        android:textSize="14dp"
                        android:gravity="center"
                        android:layout_marginRight="10dp"
                       />

                    </LinearLayout>
                </LinearLayout>


            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:text="Tactic"
                android:layout_marginLeft="15dp"
                android:textSize="14dp"
                android:gravity="center"/>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tactic_linear_layout"
                android:background="@drawable/margin_color"
                android:orientation="horizontal"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="0dp"
                android:paddingBottom="10dp">




                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/add_new_tactics"
                    android:orientation="vertical">

                </LinearLayout>

            </LinearLayout>


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

                <android.support.design.widget.AppBarLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/rectangele_width"
                   >

                    <android.support.design.widget.TabLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:id="@+id/tab_layout"
                        app:tabMode="fixed"
                        app:tabTextColor="#ccc"
                        app:tabPaddingStart="12dp"
                        app:tabSelectedTextColor="#D32F2F"
                        app:tabIndicatorColor="#D32F2F"
                        app:tabGravity="fill"
                        ></android.support.design.widget.TabLayout>

                </android.support.design.widget.AppBarLayout>


            </LinearLayout>


            <android.support.v4.view.ViewPager
                android:layout_width="match_parent"
                android:layout_height="420dp"
                android:id="@+id/viewPager2"
                android:background="#FAFAFA">
            </android.support.v4.view.ViewPager>
        </LinearLayout>

    </ScrollView>

</LinearLayout>


替换android.support.v4.widget.NestedScrollView而不是scroll view。它对我来说很有用试试这个….

NestedScrollView
代替它。我怎样才能用NestedScrollView代替scroll View呢?只要用它就行了。用谷歌搜索你的答案