Nestedscrollview 平滑滚动问题。屏幕闪烁问题

Nested-Scrollview smooth scroll issue. Screen flicker propblem

我是 Android 开发新手。我遇到了嵌套 ScrollView 的问题。嵌套的 ScrollView 里面有 3 个 RecyclerView。我的嵌套滚动视图中只有一个父 Linearlayout。我还设置了 nestedscrollEnbaled=false。然后我也无法实现平滑滚动。请帮助我解决问题。

    <?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
    tools:context=".fragments.HomeFragment">

    <com.facebook.shimmer.ShimmerFrameLayout
        android:id="@+id/shimmer_view_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

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

            <include layout="@layout/shimmer_dashboard" />
        </LinearLayout>

    </com.facebook.shimmer.ShimmerFrameLayout>

    <RelativeLayout
        android:id="@+id/RelativeInternetNotAvailable"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:src="@drawable/network_unavailability">

        </ImageView>

    </RelativeLayout>


    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/simpleSwipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fillViewport="true"
            android:orientation="vertical">

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

                <RelativeLayout
                    android:id="@+id/relativeLayoutParent"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:visibility="gone">

                    <android.support.v4.view.ViewPager

                        android:id="@+id/viewflipper"
                        android:layout_width="wrap_content"
                        android:layout_height="@dimen/_180sdp"
                        android:layout_marginTop="@dimen/_70sdp"
                        android:autoStart="true"
                        android:flipInterval="2000">

                    </android.support.v4.view.ViewPager>

                    <me.relex.circleindicator.CircleIndicator
                        android:id="@+id/indicator"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="@dimen/_230sdp" />

                    <RelativeLayout

                        xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/relativevegetables"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/card_view"
                        android:layout_margin="@dimen/_5sdp">

                        <TextView
                            android:id="@+id/txtHomeCategories"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/_25sdp"
                            android:background="@color/faintskin"
                            android:fontFamily="serif"
                            android:gravity="center"
                            android:padding="@dimen/_5sdp"
                            android:text="Home Categories"
                            android:textColor="@color/whiteTextColor"
                            android:textSize="@dimen/_12sdp"
                            android:textStyle="bold" />

                        <ImageView

                            android:id="@+id/imgvegetables"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/txtHomeCategories"
                            android:layout_marginTop="@dimen/_10sdp"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_vegetables" />


                        <ImageView

                            android:id="@+id/imgfruitdash"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/txtHomeCategories"
                            android:layout_marginTop="@dimen/_10sdp"
                            android:layout_toRightOf="@id/imgvegetables"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_fruits"

                            />

                        <ImageView
                            android:id="@+id/imgfruitda"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/txtHomeCategories"
                            android:layout_marginTop="@dimen/_10sdp"
                            android:layout_toRightOf="@id/imgfruitdash"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_dairy" />

                        <ImageView

                            android:id="@+id/imgsprouts"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/imgvegetables"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_sprouts" />


                        <ImageView

                            android:id="@+id/imgexoticfruits"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/imgfruitdash"
                            android:layout_toRightOf="@id/imgsprouts"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_exotic_fruits"

                            />

                        <ImageView
                            android:id="@+id/imgexoticveggies"
                            android:layout_width="@dimen/_102sdp"
                            android:layout_height="@dimen/_105sdp"
                            android:layout_below="@id/imgfruitda"
                            android:layout_toRightOf="@id/imgexoticfruits"
                            android:scaleType="fitXY"
                            android:src="@drawable/home_categories_exotic_veggies" />

                    </RelativeLayout>

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

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/_5sdp"
                            android:orientation="vertical">

                            <TextView
                                android:id="@+id/txtfeatureproducts"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/_25sdp"
                                android:layout_marginLeft="@dimen/_5sdp"
                                android:layout_marginTop="@dimen/_5sdp"
                                android:layout_marginRight="@dimen/_5sdp"
                                android:background="@color/faintskin"
                                android:fontFamily="serif"
                                android:gravity="center"
                                android:padding="@dimen/_5sdp"
                                android:text="Feature Products"
                                android:textColor="@color/whiteTextColor"
                                android:textSize="@dimen/_12sdp"
                                android:textStyle="bold" />


                            <android.support.v7.widget.RecyclerView
                                android:id="@+id/featureRecycler"
                                class="android.support.v7.widget.RecyclerView"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_marginTop="@dimen/_10sdp"
                                android:background="@color/profileAccentColor"
                                android:divider="#ad5"
                                android:nestedScrollingEnabled="false"
                                android:isScrollContainer="false"
                                android:dividerHeight="2dp" />

                            <android.support.v4.widget.ContentLoadingProgressBar
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content">

                            </android.support.v4.widget.ContentLoadingProgressBar>
                        </LinearLayout>


                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/_5sdp"

                            android:orientation="vertical">

                            <TextView
                                android:id="@+id/txtfreshfarmproducts"
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/_25sdp"
                                android:layout_marginLeft="@dimen/_5sdp"
                                android:layout_marginTop="@dimen/_5sdp"
                                android:layout_marginRight="@dimen/_5sdp"
                                android:background="@color/faintskin"
                                android:fontFamily="serif"
                                android:gravity="center"
                                android:padding="@dimen/_5sdp"
                                android:text="Shreenath Vegetables Products"
                                android:textColor="@color/whiteTextColor"
                                android:textSize="@dimen/_12sdp"
                                android:textStyle="bold" />

                            <android.support.v4.widget.ContentLoadingProgressBar
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content">

                            </android.support.v4.widget.ContentLoadingProgressBar>

                            <android.support.v7.widget.RecyclerView
                                android:id="@+id/searchRecycler"
                                class="android.support.v7.widget.RecyclerView"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:layout_marginTop="@dimen/_10sdp"
                                android:background="@color/profileAccentColor"
                                android:divider="#ad5"

                                android:nestedScrollingEnabled="false"
                                android:isScrollContainer="false"


                                android:dividerHeight="2dp" />

                        </LinearLayout>

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

                            <TextView
                                android:layout_width="match_parent"
                                android:layout_height="@dimen/_50sdp"
                                android:width="@dimen/_50sdp"
                                android:background="#f7f7f7" />

                        </LinearLayout>

                    </LinearLayout>

                    <android.support.v7.widget.CardView
                        android:id="@+id/card_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/viewflipper"
                        android:layout_alignParentTop="true"
                        android:layout_marginLeft="5dp"
                        android:layout_marginTop="@dimen/_240sdp"
                        android:layout_marginRight="5dp"
                        android:layout_marginBottom="@dimen/_5sdp"
                        android:visibility="gone"
                        app:cardCornerRadius="@dimen/_10sdp"
                        app:contentPadding="5dp">

                        <RelativeLayout
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent">

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


                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:weightSum="2">

                                    <TextView
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:layout_alignParentTop="true"
                                        android:drawableLeft="@drawable/bike"
                                        android:drawablePadding="@dimen/_5sdp"
                                        android:fontFamily="serif"
                                        android:gravity="center"
                                        android:text="MORNING : "
                                        android:textColor="@color/darkgrey"
                                        android:textStyle="bold" />

                                    <TextView
                                        android:id="@+id/txtmorning"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:fontFamily="serif"
                                        android:gravity="start"
                                        android:singleLine="true"
                                        android:textColor="@color/darkgrey" />
                                </LinearLayout>

                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:weightSum="2">

                                    <TextView
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:layout_marginTop="10dp"
                                        android:drawableLeft="@drawable/bike"
                                        android:drawablePadding="@dimen/_5sdp"
                                        android:fontFamily="serif"
                                        android:gravity="center"
                                        android:singleLine="true"
                                        android:text="EVENING : "
                                        android:textColor="@color/darkgrey"
                                        android:textStyle="bold" />

                                    <TextView
                                        android:id="@+id/txtevening"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginTop="10dp"
                                        android:fontFamily="serif"
                                        android:gravity="start"
                                        android:singleLine="true"
                                        android:textColor="@color/darkgrey" />
                                </LinearLayout>

                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:weightSum="2">

                                    <TextView
                                        android:layout_width="wrap_content"
                                        android:layout_height="wrap_content"
                                        android:layout_marginTop="10dp"
                                        android:drawableLeft="@drawable/bike"
                                        android:drawablePadding="@dimen/_5sdp"
                                        android:fontFamily="serif"
                                        android:gravity="center"
                                        android:singleLine="true"
                                        android:text="EXPRESS TIME : "
                                        android:textColor="@color/darkgrey"
                                        android:textStyle="bold" />

                                    <TextView
                                        android:id="@+id/txtexpresscharges"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginTop="10dp"
                                        android:fontFamily="serif"
                                        android:gravity="start"
                                        android:singleLine="true"
                                        android:textColor="@color/darkgrey" />
                                </LinearLayout>

                            </LinearLayout>

                        </RelativeLayout>

                    </android.support.v7.widget.CardView>


                    <LinearLayout
                        android:id="@+id/search_layout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/_40sdp"
                        android:layout_marginBottom="70dp"
                        android:background="@color/colorAccent"
                        android:orientation="vertical">

                        <!--<SearchView
                            android:id="@+id/searchView"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_alignParentTop="true"
                            android:clickable="true" />
    -->

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/_35sdp"
                            android:layout_weight="2"
                            android:background="@drawable/ed_border"
                            android:orientation="horizontal">


                            <EditText
                                android:id="@+id/edtSearchBox"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/_30sdp"
                                android:layout_below="@id/toolbar"
                                android:layout_margin="@dimen/_4sdp"
                                android:layout_weight="3"
                                android:background="@color/whiteTextColor"
                                android:drawableStart="@drawable/ic_search_black_24dp"
                                android:drawablePadding="@dimen/_5sdp"
                                android:fontFamily="serif"
                                android:inputType="text"
                                android:paddingLeft="@dimen/_8sdp"
                                android:singleLine="true"
                                android:textSize="@dimen/_11sdp">

                            </EditText>

                            <ImageButton
                                android:id="@+id/imgbutton"
                                android:layout_width="wrap_content"
                                android:layout_height="@dimen/_25sdp"
                                android:layout_centerHorizontal="true"
                                android:layout_centerVertical="true"
                                android:layout_margin="@dimen/_7sdp"
                                android:layout_weight="0.4"
                                android:background="@null"
                                android:scaleType="fitXY"
                                android:src="@drawable/ic_mic_black_24dp">

                            </ImageButton>


                        </LinearLayout>


                    </LinearLayout>

                    <LinearLayout
                        android:id="@+id/searchRecyclerLinearLayout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/_75sdp"
                        android:visibility="gone">

                        <android.support.v7.widget.RecyclerView
                            android:id="@+id/searchRecyclerFromSearchView"
                            class="android.support.v7.widget.RecyclerView"
                            android:layout_width="match_parent"

                            android:nestedScrollingEnabled="false"
                            android:isScrollContainer="false"

                            android:layout_height="wrap_content"
                            android:background="@color/profileAccentColor"
                            android:divider="#ad5"
                            android:dividerHeight="2dp" />


                    </LinearLayout>

                </RelativeLayout>
            </LinearLayout>

        </android.support.v4.widget.NestedScrollView>
    </android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>

尝试在线性布局中使用多个微光布局。