【发布时间】:2019-09-29 20:28:32
【问题描述】:
我使用的是 NestedScrollView,在其中,我有一些编辑文本和按钮,然后是 RecyclerView。当我打开活动时,所有项目都开始使用 PageKeyedDataSource 从服务器获取,并且 RecyclerView 滚动非常缓慢,最后应用程序显示 ANR。
我在 android-architecture-components 的 GitHub 存储库中查看了这个问题,发现 SmartNestedScrollView 可以解决这个问题,但是当我使用 SmartNestedScrollView 时,我的回收站视图只有一小部分会滚动。
https://github.com/googlesamples/android-architecture-components/issues/215
LayoutFile.xml
<?xml version="1.0" encoding="utf-8"?>
<com.magtappofficial.app.utilities.SmartNestedScrollView
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"
android:fillViewport="true"
android:layout_margin="16dp"
tools:context=".ui.Home">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0px"
android:layout_height="0px"/>
<EditText.../>
<ImageView.../>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/newsProgress"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/exclusiveForYou"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/newsRecycler"
android:layout_marginTop="16dp"
app:layout_constraintTop_toBottomOf="@+id/exclusiveForYou"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.magtappofficial.app.utilities.SmartNestedScrollView>
谁能告诉我我还能做什么?
【问题讨论】:
-
人们只是来把每一个他们不知道答案的合理问题降级,这很好,但这是一些重要问题还没有解决方案的主要原因。
-
继续努力,伙计们
-
你找到解决办法了吗?
-
@SaurabhThorat,好吧。
标签: android android-recyclerview android-architecture-components android-nestedscrollview android-paging-library