Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用coordinatorlayout在nestedscrollview中嵌套recycleview_Android_Android Coordinatorlayout_Nestedscrollview - Fatal编程技术网

Android 使用coordinatorlayout在nestedscrollview中嵌套recycleview

Android 使用coordinatorlayout在nestedscrollview中嵌套recycleview,android,android-coordinatorlayout,nestedscrollview,Android,Android Coordinatorlayout,Nestedscrollview,Im之后的效果是,nestedscrollview中的视图应滚动到屏幕顶部,并使用“滚动|始终输入”删除工具栏 一旦出现这种情况,recycleview应该可以滚动 当前,recycleview滚动条不需要移除工具栏 有什么办法可以解决这个问题吗 这就是我目前所拥有的 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:andr

Im之后的效果是,nestedscrollview中的视图应滚动到屏幕顶部,并使用“滚动|始终输入”删除工具栏 一旦出现这种情况,recycleview应该可以滚动

当前,recycleview滚动条不需要移除工具栏

有什么办法可以解决这个问题吗

这就是我目前所拥有的

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">



    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:contentInsetStart="0dp"
            android:contentInsetLeft="0dp"
            app:contentInsetLeft="0dp"
            app:contentInsetStart="0dp"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways">    
        </android.support.v7.widget.Toolbar>

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








    <android.support.v4.widget.NestedScrollView
        android:background="@android:color/holo_blue_light"
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:fitsSystemWindows="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:fitsSystemWindows="true"
            android:orientation="vertical"
            android:padding="10dp"
            android:background="@android:color/white"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/searchDisplay">
            <TextView
                android:text="Possible Artists:"
                android:textStyle="bold"
                android:textColor="@android:color/holo_green_dark"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />


            <android.support.v7.widget.RecyclerView
                android:fitsSystemWindows="true"
                android:background="@android:color/holo_green_light"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:id="@+id/recyclevertscroller"
                android:scrollbars="vertical"
                android:layout_width="match_parent"
                android:layout_height="500dp"/>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>


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


基本上是一个带有标题的RecyclerView,如果我理解正确的话。使用自定义的RecyclerView适配器,其中第一个位置总是一个文本视图,上面写着“可能的艺术家:”。删除NestedScrollView。必须将其删除。您可能在某个点上有图像视图和文本视图。如果用户直接进入recycleview,则不会获得coordinator视图效果。您只能侦听一个视图的滚动-NestedScrollView或recycleview。ScrollView中的RecyclerView与ScrollView中的ListView一样令人讨厌,它只是不能按预期工作。如果可以不使用视图循环,请仅使用NestedScrollView。如果需要视图循环,请在RecyclerView适配器中添加标题(自定义视图类型)。