2

Ich möchte Pull implementieren, um für die ganze Seite zu aktualisieren, die ich jetzt gerade mache. content_main hat viewpager und recycleview.DrawerLayout + App-Leiste + CoordinatorLayout ziehen, um zu aktualisieren

so, wie ich kann Pull für die vollständige Seite zu aktualisieren haben

base.xml

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


<include 
    layout="@layout/app_bar_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
<!-- The navigation drawer --> 
<android.support.design.widget.NavigationView 
    android:id="@+id/navigation" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 

    android:fitsSystemWindows="true"> 

app_bar_main.xml

 <android.support.design.widget.AppBarLayout 
      android:id="@+id/appBar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:theme="@style/AppTheme.AppBarOverlay"> 

      <android.support.design.widget.CollapsingToolbarLayout 
       android:id="@+id/toolbar_layout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       app:expandedTitleGravity="center" 
         app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"> 

    <android.support.v4.view.ViewPager 

        android:layout_width="match_parent" 
        android:layout_height="200dp" 
        android:layout_marginTop="?attr/actionBarSize" 

        app:layout_collapseMode="pin" /> 

<include layout="@layout/content_main" /> 

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

Antwort

0

Werfen Sie einen Blick auf diesen Code:

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


       <android.support.design.widget.CoordinatorLayout 
        android:id="@+id/coordinator" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <include layout="@layout/app_bar_main" /> 

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


         <include layout="@layout/content_main" /> 
        </android.support.v4.widget.SwipeRefreshLayout> 

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

      <android.support.design.widget.NavigationView 
      android:id="@+id/navigation" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:fitsSystemWindows="true"> 

    </android.support.v4.widget.DrawerLayout> 
+0

auch ich brauche app_bar_main Refresh als App-Leiste zu sein, einige Karte ui haben – andro

+0

nicht sicher, was du meinst. Du möchtest nicht, dass das Verhalten so ist, wie es Googles Inbox hat? –

+0

ich möchte die ganze Seite einschließlich CollapsingToolbarLayout aktualisieren, die einige Layout wie Textansicht – andro

Verwandte Themen