Home | History | Annotate | Download | only in fragments
      1 page.title=Building a Dynamic UI with Fragments
      2 page.tags="fragments", "user interface", "support library"
      3 
      4 trainingnavtop=true
      5 startpage=true
      6 
      7 @jd:body
      8 
      9 <div id="tb-wrapper">
     10 <div id="tb">
     11 
     12 
     13 <h2>Dependencies and prerequisites</h2>
     14 <ul>
     15   <li>Basic knowledge of the Activity lifecycle (see <a
     16 href="{@docRoot}training/basics/activity-lifecycle/index.html">Managing the Activity
     17 Lifecycle</a>)</li>
     18   <li>Experience building <a href="{@docRoot}guide/topics/ui/declaring-layout.html">XML
     19 layouts</a></li>
     20 </ul>
     21 
     22 
     23 <h2>You should also read</h2>
     24 <ul>
     25   <li><a href="{@docRoot}guide/components/fragments.html">Fragments</a></li>
     26   <li><a href="{@docRoot}guide/practices/tablets-and-handsets.html">Supporting Tablets and
     27 Handsets</a></li>
     28 </ul>
     29 
     30 
     31 <h2>Try it out</h2>
     32 
     33 <div class="download-box">
     34  <a href="http://developer.android.com/shareables/training/FragmentBasics.zip"
     35 class="button">Download the sample</a>
     36  <p class="filename">FragmentBasics.zip</p>
     37 </div>
     38 
     39 </div>
     40 </div>
     41 
     42 <p>To create a dynamic and multi-pane user interface on Android, you need to encapsulate
     43 UI components and activity behaviors into modules that you can swap into and out of
     44 your activities. You can create these modules with the {@link android.app.Fragment} class, which
     45 behaves somewhat like a nested activity that can define its own layout and manage its own
     46 lifecycle.</p>
     47 
     48 <p>When a fragment specifies its own layout, it can be configured in different combinations with
     49 other fragments inside an activity to modify your layout configuration for different screen
     50 sizes (a small screen might show one fragment at a time, but a large screen can show two or
     51 more).</p>
     52 
     53 <p>This class shows you how to create a dynamic user experience with fragments and optimize your
     54 app's user experience for devices with different screen sizes, all while continuing to support
     55 devices running versions as old as Android 1.6.</p>
     56 
     57 <h2>Lessons</h2>
     58  
     59 <dl>
     60   <dt><b><a href="creating.html">Creating a Fragment</a></b></dt>
     61     <dd>Learn how to build a fragment and implement basic behaviors within its callback
     62 methods.</dd>
     63   <dt><b><a href="fragment-ui.html">Building a Flexible UI</a></b></dt>
     64     <dd>Learn how to build your app with layouts that provide different fragment configurations for
     65 different screens.</dd>
     66   <dt><b><a href="communicating.html">Communicating with Other Fragments</a></b></dt>
     67     <dd>Learn how to set up communication paths from a fragment to the activity and other
     68 fragments.</dd>
     69 </dl> 
     70 
     71