| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 1 | page.title=Get Started |
| 2 | |
| 3 | @jd:body |
| 4 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 5 | <div id="qv-wrapper"> |
| 6 | <div id="qv"> |
| 7 | <h2>In this document</h2> |
| 8 | <ol> |
| 9 | <li><a href="#applytheme">Apply the Material Theme</a></li> |
| 10 | <li><a href="#layouts">Design Your Layouts</a></li> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 11 | <li><a href="#depth">Specify Elevation in Your Views</a></li> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 12 | <li><a href="#widgets">Use the New UI Widgets</a></li> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 13 | <li><a href="#animations">Customize Your Animations</a></li> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 14 | </ol> |
| 15 | </div> |
| 16 | </div> |
| 17 | |
| 18 | <p>To create apps with material design:</p> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 19 | |
| 20 | <ol> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 21 | <li style="margin-bottom:10px"> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 22 | Take a look at the <a href="http://www.google.com/design/spec">material design |
| 23 | specification</a>.</li> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 24 | <li style="margin-bottom:10px"> |
| 25 | Apply the material <strong>theme</strong> to your app.</li> |
| 26 | <li style="margin-bottom:10px"> |
| 27 | Define additional <strong>styles</strong> to customize the material theme.</li> |
| 28 | <li style="margin-bottom:10px"> |
| 29 | Create your <strong>layouts</strong> following material design guidelines.</li> |
| 30 | <li style="margin-bottom:10px"> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 31 | Specify the <strong>elevation</strong> of your views to cast appropriate shadows.</li> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 32 | <li style="margin-bottom:10px"> |
| 33 | Use the new <strong>widgets</strong> for complex views, such as lists and cards.</li> |
| 34 | <li style="margin-bottom:10px"> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 35 | Use the new APIs to customize the <strong>animations</strong> in your app.</li> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 36 | </ol> |
| 37 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 38 | <h3>Update Your App for the Android L Developer Preview</h3> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 39 | |
| 40 | <p>To update an existing app for the Android L Developer Preview, design new layouts following |
| 41 | material design guidelines and consider how you can improve the user experience for your app by |
| 42 | incorporating depth, touch feedback and animations in your UI.</p> |
| 43 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 44 | <h3>Create New Apps for the Android L Developer Preview</h3> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 45 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 46 | <p>If you are creating a new app for the Android L Developer Preview, the <a |
| 47 | href="http://www.google.com/design/spec">material design guidelines</a> provide you with a |
| 48 | cohesive design framework for your app. Follow these guidelines and |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 49 | use the new functionality in the Android framework to design and develop your app.</p> |
| 50 | |
| 51 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 52 | <h2 id="applytheme">Apply the Material Theme</h2> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 53 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 54 | <p>To apply the material theme in your app, specify a style that inherits from |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 55 | <code>android:Theme.Material</code>:</p> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 56 | |
| 57 | <pre> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 58 | <!-- res/values/styles.xml --> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 59 | <resources> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 60 | <!-- your app's theme inherits from the Material theme --> |
| 61 | <style name="AppTheme" parent="android:Theme.Material"> |
| 62 | <!-- theme customizations --> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 63 | </style> |
| 64 | </resources> |
| 65 | </pre> |
| 66 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 67 | <p>The material theme provides new system widgets that let you set their color palette and default |
| 68 | animations for touch feedback and activity transitions. For more details, see |
| 69 | <a href="{@docRoot}preview/material/theme.html">Material Theme</a>.</p> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 70 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 71 | |
| 72 | <h2 id="layouts">Design Your Layouts</h2> |
| 73 | |
| 74 | <p>In addition to applying and customizing the material theme, your layouts should conform to |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 75 | the <a href="http://www.google.com/design/spec">material design guidelines</a>. When you design |
| 76 | your layouts, pay special attention to the following:</p> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 77 | |
| 78 | <ul> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 79 | <li>Baseline grids</li> |
| 80 | <li>Keylines</li> |
| 81 | <li>Spacing</li> |
| 82 | <li>Touch target size</li> |
| 83 | <li>Layout structure</li> |
| Robert Ly | 2055529 | 2014-06-13 23:28:19 -0700 | [diff] [blame] | 84 | </ul> |
| 85 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 86 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 87 | <h2 id="depth">Specify Elevation in Your Views</h2> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 88 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 89 | <p>Views can cast shadows, and the elevation value of a view |
| 90 | determines the size of its shadow and its drawing order. To set the elevation of a view, use the |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 91 | <code>android:elevation</code> attribute in your layouts:</p> |
| 92 | |
| 93 | <pre> |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 94 | <TextView |
| 95 | android:id="@+id/my_textview" |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 96 | android:layout_width="wrap_content" |
| 97 | android:layout_height="wrap_content" |
| 98 | android:text="@string/next" |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 99 | android:background="@color/white" |
| 100 | <strong>android:elevation</strong>="5dp" /> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 101 | </pre> |
| 102 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 103 | <p>The new <code>translationZ</code> property lets you create animations that reflect temporary |
| 104 | changes in the elevation of a view. For example, this is useful to respond to touch gestures.</p> |
| 105 | |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 106 | <p>For more details, see <a href="{@docRoot}preview/material/views-shadows.html">Views and |
| 107 | Shadows</a>.</p> |
| 108 | |
| 109 | |
| 110 | <h2 id="widgets">Use the New UI Widgets</h2> |
| 111 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 112 | <p><code>RecyclerView</code> is a more advanced version of <code>ListView</code> that provides |
| 113 | performance improvements and is easier to use. <code>CardView</code> lets you show pieces of |
| 114 | information inside cards with a consistent look across apps. To include a <code>CardView</code> |
| 115 | in your layout:</p> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 116 | |
| 117 | <pre> |
| 118 | <android.support.v7.widget.CardView |
| 119 | android:id="@+id/card_view" |
| 120 | android:layout_width="200dp" |
| 121 | android:layout_height="200dp" |
| 122 | card_view:cardCornerRadius="3dp"> |
| 123 | ... |
| 124 | </android.support.v7.widget.CardView> |
| 125 | </pre> |
| 126 | |
| 127 | <p>For more information, see <a href="{@docRoot}preview/material/ui-widgets.html">UI Widgets</a>.</p> |
| 128 | |
| 129 | |
| Ricardo Cervera | 6dacb26 | 2014-06-19 14:40:37 -0700 | [diff] [blame] | 130 | <h2 id="animations">Customize Your Animations</h2> |
| Ricardo Cervera | d9a70a7 | 2014-06-16 12:15:44 -0700 | [diff] [blame] | 131 | |
| 132 | <p>The Android L Developer Preview includes new APIs to create custom animations in your app. |
| 133 | For example, you can enable activity transitions and define an exit transition inside an |
| 134 | activity:</p> |
| 135 | |
| 136 | <pre> |
| 137 | // inside your activity |
| 138 | getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); |
| 139 | |
| 140 | // set an exit transition |
| 141 | getWindow().setExitTransition(new Explode()); |
| 142 | </pre> |
| 143 | |
| 144 | <p>When you start another activity from this activity, the exit transition is activated.</p> |
| 145 | |
| 146 | <p>To learn about all the features in the new APIs, see <a |
| 147 | href="{@docRoot}preview/material/animations.html">Animations</a>.</p> |