Home | History | Annotate | Download | only in EffectiveNavigation
      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!--
      3  Copyright 2017 The Android Open Source Project
      4 
      5  Licensed under the Apache License, Version 2.0 (the "License");
      6  you may not use this file except in compliance with the License.
      7  You may obtain a copy of the License at
      8 
      9      http://www.apache.org/licenses/LICENSE-2.0
     10 
     11  Unless required by applicable law or agreed to in writing, software
     12  distributed under the License is distributed on an "AS IS" BASIS,
     13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  See the License for the specific language governing permissions and
     15  limitations under the License.
     16 -->
     17 <sample>
     18     <name>EffectiveNavigation</name>
     19     <group>UI</group>
     20     <package>com.example.android.effectivenavigation</package>
     21 
     22     <!-- change minSdk if needed-->
     23     <minSdk>9</minSdk>
     24 
     25     <strings>
     26         <intro>
     27             <![CDATA[
     28 This sample demonstrates how to create swipe views with tabs. Users can swipe
     29 between tabs, or click on a tab title to jump to the section. Some tabs are
     30 scrollable, meaning that users can scroll horizontally through the tab strip and
     31 select a tab.
     32 ]]>
     33         </intro>
     34         <sample_action>Effective Navigation</sample_action>
     35     </strings>
     36 
     37     <metadata>
     38         <status>PUBLISHED</status>
     39         <categories>UI</categories>
     40         <technologies>Android</technologies>
     41         <languages>Java</languages>
     42         <solutions>Mobile</solutions>
     43         <level>BEGINNER</level>
     44         <icon>screenshots/icon-web.png</icon>
     45         <screenshots>
     46             <img>screenshots/1-main.png</img>
     47             <img>screenshots/2-collection.png</img>
     48         </screenshots>
     49         <api_refs>
     50             <android>android.support.v4.view.ViewPager</android>
     51             <android>android.support.design.widget.TabLayout</android>
     52             <android>android.support.v4.app.NavUtils</android>
     53         </api_refs>
     54         <description>
     55             <![CDATA[
     56 This sample demonstrates how to create swipe views with tabs. Users can swipe
     57 between tabs, or click on a tab title to jump to the section. Some tabs are
     58 scrollable, meaning that users can scroll horizontally through the tab strip and
     59 select a tab.
     60 ]]>
     61         </description>
     62         <intro>
     63             <![CDATA[
     64 This sample use combination of [ViewPager][1] and [TabLayout][2] to create swipe
     65 views with tabs.
     66 
     67 In order to use ViewPager, you first need to implement a PagerAdapter to feed
     68 its content. In this sample, we use [FragmentPagerAdapter][3] and
     69 [FragmentStatePagerAdapter][4]. FragmentPagerAdapter is useful when you have a
     70 limited number of fixed pages. FragmentStatePagerAdapter can be used for
     71 ViewPager with a lot of pages as it can save and restore state of Fragments
     72 inside of it in a memory-efficient way.
     73 
     74 Using TabLayout with ViewPager is simple. Just call the method
     75 [setupWithViewPager(ViewPager)][5], and the TabLayout generates corresponding
     76 tabs for the ViewPager. The titles are populated from [getPageTitle(int)][6]
     77 method of your ViewPager adapter.
     78 
     79 [1]: https://developer.android.com/reference/android/support/v4/view/ViewPager.html
     80 [2]: https://developer.android.com/reference/android/support/design/widget/TabLayout.html
     81 [3]: https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html
     82 [4]: https://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html
     83 [5]: https://developer.android.com/reference/android/support/design/widget/TabLayout.html#setupWithViewPager(android.support.v4.view.ViewPager)
     84 [6]: https://developer.android.com/reference/android/support/v4/view/PagerAdapter.html#getPageTitle(int)
     85 ]]>
     86         </intro>
     87     </metadata>
     88 </sample>
     89