2017-06-14 8 views
0

私のアプリにはネストされたスクロールビューがあります。問題はスクロールが遅いことです。Recyclerview inside nestedscrollview - スロースクロールアンドロイド6?

問題は、私は私のクラスでこれを持っているアンドロイド6.

で発生します。

RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); 
    recyclerView.setHasFixedSize(true); 

    recyclerView.setNestedScrollingEnabled(false); 

のxml:

<?xml version="1.0" encoding="utf-8"?> 

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/swipeContainer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<android.support.v4.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:descendantFocusability="blocksDescendants"> 

    <RelativeLayout 
     android:id="@+id/pro" 
     android:layout_width="match_parent" 
     android:layout_height="120dp" 
     android:background="?attr/colorPrimary" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 


     <ImageView 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/imageViewP" 
      android:layout_width="30dp" 
      android:layout_height="30dp" 
      android:cropToPadding="false" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginBottom="10dp" 
      /> 

    </RelativeLayout> 



     <RelativeLayout 
      android:id="@+id/p2" 
      android:layout_width="match_parent" 
      android:layout_height="80dp" 
      android:background="#fff" 
      android:layout_below="@+id/pro" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true"> 


     <TextView 
      android:text="Sells" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/textView4" 
      android:textStyle="normal|bold" 
      android:layout_marginRight="66dp" 
      android:layout_marginEnd="66dp" 
      android:layout_alignParentTop="true" 
      android:textSize="12dp" 
      android:layout_marginTop="5dp" /> 

     <TextView 
      android:text="0" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/idFollowers" 
      android:gravity="center" 
      android:layout_below="@+id/textView4" 
      android:layout_alignLeft="@+id/textView4" 
      android:layout_alignStart="@+id/textView4" 
      android:layout_alignRight="@+id/textView4" 
      android:textSize="12dp" 
      android:layout_alignEnd="@+id/textView4" /> 




     </RelativeLayout> 


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

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="none" 
      android:layout_below="@+id/p2" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" /> 


    </RelativeLayout> 

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

    </android.support.v4.widget.SwipeRefreshLayout> 

任意のアイデアをどのようにスムーズなスクロールを取得しますか?なぜそれは私のアンドロイド6で遅いですか?

答えて

1

なぜNestedScrollViewでRecyclerViewを入れ子にしているのですか?RecyclerViewは既に独自のスクロールを処理していますが、両方がフォーカスを得るために苦労している可能性があります。 は、すでに指摘したようにSwipeRefreshLayoutが既にスクロールを消費するので、swipeRefreshLayも犯人

+0

可能性もNestedScrollView

android:descendantFocusability="blocksDescendants" 

にこれを追加RecyclerView

android:focusable="false" android:focusableInTouchMode="true" 

にこれらを追加します。 –

関連する問題