【发布时间】:2017-04-04 12:44:47
【问题描述】:
我正在尝试添加一个 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>
但是我在尝试这个时遇到了两个问题:
相关布局 ID/配置文件正在消失。当我打开活动时,它会出现 1 秒钟然后消失。
RecyclerView 滚动太慢。
有什么想法吗?
【问题讨论】:
-
将相对布局设为父级。并在其中制作 NestedScrollview。现在在其中移动其他布局和recyclerview
-
为什么
RecyclerView在ScrollView下?? -
@IntelliJAmiya 我想一起滚动标题(id/profile)和recyclerview。如果我不添加滚动视图,我将无法滚动标题。
标签: android android-layout android-recyclerview android-xml android-scrollview