0

Mein horizontaler RecyclerView in nestedScrollView funktioniert nicht ordnungsgemäß. Wenn ich die RecyclerView horizontal scrolle, fängt meine NestedScrollView die Eingabe als vertikales Scroll und nur einmal auf vier Mal das horizontale Scroll funktioniert gut. Wie kann ich es lösen? Ich habe keine Probleme mit normalem ScrollView. Ich habe es noch mit horizontalScrollView versucht und ich habe das gleiche Problem. Ich muss nestedScrollView verwenden, da ich Collapse ein Bild und die Symbolleiste verwenden möchte.Horizontale Recycler-Ansicht in nestedScrollView funktioniert nicht richtig

Hier ist mein xml-Code:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
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:id="@+id/coordinator_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 

> 

<android.support.design.widget.AppBarLayout 

    android:id="@+id/main.appbar" 
    android:layout_width="match_parent" 
    android:layout_height="174dp" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 

    > 

    <android.support.design.widget.CollapsingToolbarLayout 

     android:id="@+id/main.collapsing" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginEnd="64dp" 
     app:expandedTitleMarginStart="48dp" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 

     > 


     <ImageView 

      android:id="@+id/main.backdrop" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/test_primi" 
      app:layout_collapseMode="parallax" 

      /> 


     <android.support.v7.widget.Toolbar 

      android:id="@+id/main.toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="54dp" 
      app:layout_collapseMode="pin" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      android:layout_gravity="top" 

      > 

     </android.support.v7.widget.Toolbar> 

     <RelativeLayout 

      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      app:layout_scrollFlags="scroll|enterAlwaysCollapsed" 

      > 

      <LinearLayout 

       android:id="@+id/linear_layout_titolo_toolbar_primi" 
       android:layout_width="match_parent" 
       android:layout_height="56dp" 
       android:orientation="horizontal" 
       app:layout_scrollFlags="scroll|enterAlwaysCollapsed" 

       > 

       <ImageView 

        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_gravity="center" 
        android:onClick="backToRicette" 
        android:padding="8dp" 
        android:src="@drawable/icona_freccia_back_bianca" 

        /> 

       <TextView 

        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="18dp" 
        android:fontFamily="@font/roboto_medium" 
        android:gravity="start|center" 
        android:text="Primi" 
        android:textColor="@color/titoliToolbar" 
        android:textSize="@dimen/dimensioneTitoliToolbar" 

        /> 

      </LinearLayout> 

     </RelativeLayout> 

    </android.support.design.widget.CollapsingToolbarLayout> 


</android.support.design.widget.AppBarLayout> 

<android.support.v4.widget.NestedScrollView 

    android:id="@+id/nested_scroll_view_ricette_primi" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:addStatesFromChildren="false" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 

    > 

     <LinearLayout 

      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/body" 
      android:orientation="vertical" 

      > 

      <!-- paragrafo "top 10 ricette" comprendente titolo immagini e testo sotto le immagini --> 
      <LinearLayout 

       android:id="@+id/linear_layout_ricette_top_10" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="@dimen/margineLateraleLayout" 
       android:layout_marginRight="@dimen/margineLateraleLayout" 
       android:layout_marginTop="@dimen/margineTraLayout" 
       android:layout_marginBottom="@dimen/margineTraLayout" 
       android:background="@color/transparent" 
       android:elevation="2dp" 
       android:orientation="vertical" 

       > 

       <TextView 

        android:id="@+id/text_view_top_10_ricette" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="8dp" 
        android:layout_marginLeft="8dp" 
        android:layout_marginTop="8dp" 
        android:fontFamily="@font/roboto_medium" 
        android:text="Top 10 Primi" 
        android:textColor="@color/titoliLayout" 
        android:textSize="@dimen/dimensioneTitoli" 

        /> 

       <android.support.v7.widget.RecyclerView 

        android:id="@+id/list" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_margin="8dp" 
        android:nestedScrollingEnabled="true" 
        > 


       </android.support.v7.widget.RecyclerView> 


       <!-- scroll orizzontale delle immagini e del testo (NO TITOLO TOP 10 RICETTE)--> 


      </LinearLayout> 

      <LinearLayout 

       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="@dimen/margineTraLayout" 
       android:layout_marginLeft="@dimen/margineLateraleLayout" 
       android:layout_marginRight="@dimen/margineLateraleLayout" 
       android:background="@color/body" 
       android:orientation="vertical" 


       ><TextView 

        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="16dp" 
        android:layout_marginLeft="8dp" 
        android:text="Preparazioni" 
        android:textColor="@color/sottoTitoli" 
        android:textSize="@dimen/dimensioneSottoTitoli" 

        /> 

und nachdem ich meine alle Tags schließen

Antwort

0

try Recyclerview nestedScrolling Aktiviert falsch zu ändern. in Ihrem Code setzen Sie es als wahr

Änderung

android:nestedScrollingEnabled="true" 

Um

android:nestedScrollingEnabled="false" 
+0

ich das schon getan haben. Kein Erfolg – Mtt95dvlpr

Verwandte Themen