2015-06-03 12 views
36

मैं नई समर्थन लाइब्रेरी 22.2.0 से ऑटो छुपा टूलबार सुविधा को लागू करने का प्रयास करता हूं। SwipeRefreshLayout बिना ठीक काम कर रहा है:एंड्रॉइड: कोऑर्डिनेटर लेआउट और स्वाइप रीफ्रेशलाइट

enter image description here

लेकिन मैं इस लेआउट जोड़ने फिर जब, उपकरण पट्टी ओवरलैप recyclerview:

enter image description here

कोड:

<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.CoordinatorLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:fab="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <android.support.v7.widget.Toolbar 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       android:theme="@style/ThemeOverlay.ActionBar" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
       app:layout_scrollFlags="scroll|enterAlways"/> 

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

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

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/cardList" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scrollbars="vertical" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

     </android.support.v4.widget.SwipeRefreshLayout> 
    </android.support.design.widget.CoordinatorLayout> 
</android.support.v4.widget.DrawerLayout> 

एक y विचार यह कैसे ठीक करें?

उत्तर

79

स्क्रॉल व्यवहार को SwipeRefreshLayout पर RecyclerView पर सेट करें।

<android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/cardList" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbars="vertical" /> 

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

धन्यवाद! यह काम कर रहा है;) – Tomas

+1

आपको बहुत धन्यवाद ... – Hani

+1

@ टॉमस मैं यह पूछना चाहूंगा कि आपने देखा है कि यदि आप ऐपबारलाउट पूरी तरह से विस्तारित हो जाते हैं (लंबवत ऑफसेट 0 तक पहुंच गया) तक स्क्रॉल करना शुरू करते हैं और आप स्वाइप रीफ्रेशलाइट के ताज़ा संकेतक को स्क्रॉल करते रहते हैं, इस प्रकार उपयोगकर्ता इस क्रिया को भी ट्रिगर करने में सक्षम होगा। RecyclerView पर केवल कुछ तत्व होने के कारण, कम से कम मेरे पक्ष में पुन: पेश करना आसान है। किसी भी तरह की सहायता का स्वागत किया जाएगा। –

संबंधित मुद्दे