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