ScrollView慢速滚动且项目消失

Gab*_*ias 0 android android-layout android-xml android-scrollview android-recyclerview

我正在尝试添加ScrollView来保存标头和RecyclerView。

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

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

    <RelativeLayout
        android:id="@+id/profile"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="?attr/colorPrimary">

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:id="@+id/imageView"
            android:adjustViewBounds="true"
            android:cropToPadding="false" />


    </RelativeLayout>


    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:scrollbars="none"
        android:layout_alignParentLeft="true" />


    </RelativeLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

但是我有两个问题尝试这样做:

  • 相对布局ID /配置文件正在消失。当我打开活动时,它会显示1秒钟,然后消失。

  • RecyclerView滚动太慢。

有任何想法吗?

Lui*_*rra 5

默认情况下,RecyclerView它有自己的滚动条,与您的冲突ScrollView。要解决此问题,请将更改ScrollViewNestedScrollView