-1

something similar to image that on call of SwipeRefreshLayoutListener my whole layout should go down Je souhaite déplacer la mise en page entière lorsque SwipeRefreshLayout Listener est appelé? Est-ce que cette chose est possible chez android? Ceci est toute ma mise en page xml.SwipeRefreshLayout contient une barre de progression et FrameLayout et qui est inclus dans un RelativeLayout.So je veux que le FrameLyout devrait s'arrêter quand j'appelle pour l'actualisation.Déplacer toute la mise en page sur swipeRefreshLayoutListener android

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:custom="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <android.support.v4.widget.DrawerLayout 
     android:id="@+id/drawer_navigation_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 

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

      <include 
       android:id="@+id/toolbar" 
       layout="@layout/toolbar_layout" /> 

      <android.support.v4.widget.SwipeRefreshLayout 
       android:id="@+id/swipeRefresh" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@id/toolbar"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical"> 

        <ProgressBar 
         android:id="@+id/horizontal_sync_progress" 
         style="@style/Widget.AppCompat.ProgressBar.Horizontal" 
         android:layout_width="match_parent" 
         android:layout_height="1dp" 
         android:background="@color/gradient_bg_end" 
         android:indeterminateDrawable="@drawable/progress_drawable" 
         android:progressDrawable="@drawable/progress_drawable" 
         android:visibility="gone"/> 

        <FrameLayout 
         android:id="@+id/container_frag" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" /> 
       </LinearLayout> 
      </android.support.v4.widget.SwipeRefreshLayout> 
     </RelativeLayout> 

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

ce que vous essayez jusqu'à maintenant? S'il vous plaît poster un code –

+2

vous devez définir SwipeRefreshLayout sur le dessus dans le fichier XML. –

+0

ya..je vais partager mon xml – Divya

Répondre

1
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

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

<-----Your design here------> 

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

</RelativeLayout> 

essayer. vous devez définir votre SwipeRefreshLayout ci-dessus. J'espère que cela vous aide. Si cela ne vous aide à me demander quel est le problème que je vais vous aider

Et mon code de classe est inférieure à

mSwipeRefreshLayout1 = (SwipeRefreshLayout) findViewById(R.id.swp1); 
      //set colors if you need 
mSwipeRefreshLayout1.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorPrimaryLight); 
      mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 
       @Override 
       public void onRefresh() { 
        mSwipeRefreshLayout1.setRefreshing(true); 
        try { 

         //Refresh data 

        } catch (Exception e) { 
         //Toast.makeText(getActivity(), String.valueOf(e.getMessage()), Toast.LENGTH_SHORT).show(); 
         //customtoast.ShowToast(getActivity(), String.valueOf(e.getMessage()), R.layout.red_toast); 
        } 
       } 
      }); 
+0

@Divya cela vous aide? SI cela vous aide à faire cela comme une réponse correcte pour que les autres obtiennent de l'aide de cela –

+0

Ralentissez ... Vous venez de poster cette réponse. –

+0

@Zaki il ne tire pas la mise en page à la demande de swipeRefreshLayoutListener. Je veux tirer le framelayout vers le bas. comment faire ça? – Divya

0

vous pouvez coder comme celui-ci

swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 
     @Override 
     public void onRefresh() { 
      new class(getActivity(), listView, progressBar, mApp.getPreference().getString(Common.u_id, ""), "all", swipe).execute(); 
     } 
    }); 
    return view; 
} 

Inclure le code ci-dessous votre fichier xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    //your xml codes 
    </RelativeLayout> 
</android.support.v4.widget.SwipeRefreshLayout>