0

ich NestedScrollView in Tab Layout verwende und wenn ich RecyclerView in NestedScrollView implementiert 2 Probleme auftreten:RecyclerView funktioniert nicht in NestedScrollView

  1. Toolbar versteckt sich nicht.
  2. RecyclerView in nicht reibungslos scrollen.

Hier ist mein Code:

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

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:background="#fff" 
     android:layout_height="wrap_content"> 

     <android.support.v7.widget.RecyclerView 
      android:layout_below="@+id/toolbar" 
      android:id="@+id/recyclerView" 
      android:background="#fafafa" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" /> 

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

    </RelativeLayout> 

</android.support.v4.widget.NestedScrollView> 
+0

Haben Sie in NestedScrollView Symbolleiste, weil nach Ihrem Code fügen Sie Ihre RecyclerView mit Android: layout_below = "@ + ID/Symbolleiste" –

Antwort

0

Verwendung recylerView.setNestedScrollingEnabled(false); zu Ihrem glattere Scrollen zu machen.

+0

Nein, es funktioniert nicht. –

0

Erstellen Sie separate Layoutdateien für Ansichten und versuchen Sie es. Und schließe diese in die Listenansicht ein.

<LinuearLayout ..> 
    <include layout="@layout/cv1"/> 
    <include layout="@layout/rv1"/> 
    <include layout="@layout/rv2"/> 
    <include layout="@layout/rv3"/> 
</LinearLayout> 

Dies ist nur ein Anhaltspunkt für Sie. Ich habe ähnliche Probleme schon lange in der Vergangenheit gelöst. Bitte experimentiere mit diesem Hinweis.

Verwandte Themen