-1

something similar to image that on call of SwipeRefreshLayoutListener my whole layout should go down Я хочу переместить весь макет вниз, когда вызывается SwipeRefreshLayout Listener? Возможно ли это в андроиде? Это весь мой xml layout.SwipeRefreshLayout содержит панель прогресса и FrameLayout и включен в RelativeLayout. Поэтому я хочу, чтобы FrameLyout выходил, когда я вызываю для обновления.Потяните всю макет вниз на 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

Что вы пытаетесь до сих пор? Пожалуйста, разместите код –

+2

, вы должны установить SwipeRefreshLayout сверху в xml-файле. –

+0

ya..Ill поделитесь своим xml – Divya

ответ

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> 

попробовать это. вам нужно установить SwipeRefreshLayout выше. Надеюсь, это поможет вам. Если это не помогает вы спросите меня, что это проблема я вам поможет

И Мой класс код ниже

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

@ Дивия это тебе помогает? ЕСЛИ это поможет вам сделать это правильным ответом, чтобы другие получали помощь от этого –

+0

Замедление ... Вы только что отправили этот ответ. –

+0

@ Заки это не тянет макет вниз по вызову swipeRefreshLayoutListener. Я хочу вытянуть рамку вниз. как это сделать? – Divya

0

вы можете закодировать как этот

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; 
} 

Включите код ниже в ваш 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>