2017-10-08 14 views
0

내 그룹 가로가 이고 내림차순으로 Recycleviews을 스 와이프하는 데 문제가 있습니다.Android SwipeRefreshLayout 스크롤에서 RecycleView를 중지합니다.

어떻게 이런 일이 일어나지 않게 할 수 있습니까?

아니면 스 와이프하지 않는 경우에만 새로 고침을 트리거 할 수있는 방법이 있습니까?

또한 원하는 레이아웃을 구현하는 가장 좋은 방법입니까? 좋아

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/activity_main_swipe_refresh_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_marginBottom="70dp" 
       android:isScrollContainer="false" 
       android:orientation="vertical"> 


       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:background="@drawable/block_border" 
        android:orientation="vertical"> 

        <TextView 
         android:id="@+id/trending_episodes_title" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" /> 

        <!--This is the first affected recycle --> 

        <android.support.v7.widget.RecyclerView 
         android:id="@+id/trendingEpisodesRecycle" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:clipToPadding="false" 
         android:orientation="horizontal" /> 

       </LinearLayout> 


       <!--This is the Second affected recycle --> 

       <android.support.v7.widget.RecyclerView 
        android:id="@+id/allNewsRecycle" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="@dimen/title_top" 
        android:clipToPadding="false" 
        android:orientation="horizontal" /> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:background="@drawable/block_border" 
        android:orientation="vertical"> 

        <TextView 
         android:id="@+id/moods_title" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 

         android:layout_marginTop="@dimen/title_top" 
         android:textColor="@color/colorBlack" 
         android:textSize="20sp" 
         android:textStyle="bold" /> 

        <android.support.v7.widget.RecyclerView 
         android:id="@+id/moodsRecycle" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:clipToPadding="false" 
         android:orientation="horizontal" /> 

       </LinearLayout> 
      </LinearLayout> 
     </RelativeLayout> 
    </ScrollView> 
</android.support.v4.widget.SwipeRefreshLayout> 

답변

0

은 그래서 RecycleView 터치되고있는 SwipeRefreshLayout를 사용하지 않도록 설정하여이 문제를 해결하고, 사용자가 RecycleView을 놓아 다시 한번 다시 가능하게한다.

 MyRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { 

      @Override 
      public void onScrollStateChanged(final RecyclerView recyclerView, int newState) 
      { 

       super.onScrollStateChanged(recyclerView,newState); 
       if (newState != RecyclerView.SCROLL_STATE_IDLE) { // on scroll stop 
        mSwipeRefreshLayout.setEnabled(false); 
       } 
       else 
       { 
        mSwipeRefreshLayout.setEnabled(true); 
       } 

      } 
} 
:

우는 소리는 내 프로그램에서 해당에 대한 코드입니다