0

NestedScrollView内のMy Horizo​​ntal RecyclerViewが正しく動作しません。 RecyclerViewを水平方向にスクロールすると、NestedScrollViewは入力を垂直スクロールとして捕捉し、4回に1回だけ水平スクロールがうまく動作します。どうすれば解決できますか?私は通常のScrollViewに問題はありません。私はまだhorizo​​ntalScrollViewを試してみましたが、私は同じ問題を抱えています。 イメージを折りたたみ、ツールバーを使用したいので、nestedScrollViewを使用する必要があります。ここでnestedScrollView内の水平リサイクラビューが正しく動作しません。

は私のXMLコードです:

<?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" 

        /> 

と私は私のすべてのタグを閉じた後

答えて

0

はRecyclerview nestedScrollingが有効falseに変更してみてください。あなたのコードでは、私はすでにそれをやった

android:nestedScrollingEnabled="true" 

android:nestedScrollingEnabled="false" 
+0

への真

の変化として設定します。失敗 – Mtt95dvlpr

関連する問題