Home | History | Annotate | Download | only in swipe
      1 page.title=Supporting Swipe-to-Refresh
      2 trainingnavtop=true
      3 startpage=true
      4 
      5 
      6 @jd:body
      7 
      8 <div id="tb-wrapper">
      9 <div id="tb">
     10 
     11 <h2>Dependencies and prerequisites</h2>
     12 <ul>
     13   <li>Android 1.6 (API level 4) or later
     14   </li>
     15 
     16   <li>Latest version of the Android v4 <a href=
     17   "{@docRoot}tools/support-library/index.html">Support Library</a>
     18   </li>
     19 </ul>
     20 
     21 <h2>Sample Apps</h2>
     22 
     23 <ul>
     24     <li><a href="{@docRoot}samples/SwipeRefreshLayoutBasic/index.html">
     25             SwipeRefreshLayoutBasic</a></li>
     26     <li><a href="{@docRoot}samples/SwipeRefreshListFragment/index.html">
     27             SwipeRefreshListFragment</a></li>
     28     <li><a href="{@docRoot}samples/SwipeRefreshMultipleViews/index.html">
     29             SwipeRefreshMultipleViews</a></li>
     30 </ul>
     31 
     32 </div>
     33 </div>
     34 
     35 <p>
     36   Even if your app automatically updates its content on a regular basis, you
     37   can allow users to request manual updates as well. For example, a weather
     38   forecasting app can allow users get the latest forecasts on demand. To
     39   provide a standard user experience for requesting updates, the Android
     40   platform includes the swipe-to-refresh design pattern, which allows users
     41   to trigger an update with a vertical swipe.
     42 </p>
     43 
     44 <p class="note">
     45   <strong>Note:</strong> This class requires the latest version of the Android
     46   v4 Support Library APIs. If you have not used the Support Library before,
     47   follow the instructions in the <a href=
     48   "{@docRoot}tools/support-library/setup.html">Support Library Setup</a>
     49   document.
     50 </p>
     51 
     52 <h2>Lessons</h2>
     53 
     54 <dl>
     55   <dt>
     56     <b><a href="add-swipe-interface.html">Adding Swipe-to-Refresh To Your
     57     App</a></b>
     58   </dt>
     59 
     60   <dd>
     61     <div style="width:290px;margin-right:35px;float:right">
     62       <div class="framed-nexus5-port-span-5">
     63         <video class="play-on-hover" autoplay alt=
     64         "When the user performs a swipe gesture, the SwipeRefreshLayout widget displays a progress indicator until your app finishes updating its data.">
     65         <!-- Preferred video size 216x384 (portrait) -->
     66           <source src="images/swipe.mp4">
     67         </video>
     68       </div>
     69 
     70       <div style="font-size:10pt;margin-left:20px;margin-bottom:30px">
     71         <em>To replay the movie, click on the device screen</em>
     72       </div>
     73     </div>
     74   </dd>
     75 
     76   <dd>
     77     Learn how to provide swipe-to-refresh support in a {@link
     78     android.widget.ListView} or {@link android.widget.GridView}, and how to
     79     provide an accessible refresh option using the action bar.
     80   </dd>
     81 
     82   <dt>
     83     <b><a href="respond-refresh-request.html">Responding to a Refresh
     84     Request</a></b>
     85   </dt>
     86 
     87   <dd>
     88     Learn how to respond to the swipe-to-refresh gesture, and how to perform the
     89     same update from an action bar action.
     90   </dd>
     91 </dl>
     92