Android 使用NestedScrollView时,RecyclerView滚动速度非常慢
我有一个带有NestedScrollView的RecyclerView,而RecyclerView的滚动速度非常慢。为什么会发生这种情况,我该如何解决 在Stack Overflow中搜索和搜索后,我得到了以下解决方案:Android 使用NestedScrollView时,RecyclerView滚动速度非常慢,android,android-studio,android-recyclerview,android-nestedscrollview,Android,Android Studio,Android Recyclerview,Android Nestedscrollview,我有一个带有NestedScrollView的RecyclerView,而RecyclerView的滚动速度非常慢。为什么会发生这种情况,我该如何解决 在Stack Overflow中搜索和搜索后,我得到了以下解决方案: mMyRecyclerView.setNestedScrollingEnabled(false); 但这并不能提高我的滚动速度,请帮助 这是我的xml代码 <FrameLayout xmlns:android="http://schemas.android.com/ap
mMyRecyclerView.setNestedScrollingEnabled(false);
但这并不能提高我的滚动速度,请帮助
这是我的xml代码
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="fragment.HomeFrg">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ns1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/card_background_new_design"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardElevation="5dp"
>
<LinearLayout
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="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/bestdeal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:padding="5dp"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:text="DEALS"
android:visibility="gone"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/viewall"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="end"
android:padding="5dp"
android:text="View All"
android:textColor="@color/colorPrimary"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_page2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:clipToPadding="false"
android:layout_marginBottom="5dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/activity_main_webview"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="150dp" />
<TextView
android:id="@+id/homefrgMsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/nonetwork"
android:textSize="30sp"
android:visibility="visible"
android:textStyle="normal|bold" />
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="42dp"
android:layout_gravity="center"
android:layout_height="42dp"
android:visibility="visible"
android:id="@+id/progressBar_home_frg" />
</FrameLayout>
</FrameLayout>
是google play store上的我的应用程序,供您参考。在调用线性布局管理器时尝试使用此应用程序
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false){
@Override
public boolean canScrollVertically() {
return false;
}
});
我不确定,但请尝试将RecyclerView height match\u parent包装内容