blob: 7d0625e5b88c617db856c7c099e8ee8b713152ac [file] [log] [blame]
Robert Ly20555292014-06-13 23:28:19 -07001page.title=Get Started
2
3@jd:body
4
Ricardo Cerverad9a70a72014-06-16 12:15:44 -07005<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 Cervera6dacb262014-06-19 14:40:37 -070011 <li><a href="#depth">Specify Elevation in Your Views</a></li>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070012 <li><a href="#widgets">Use the New UI Widgets</a></li>
Ricardo Cervera6dacb262014-06-19 14:40:37 -070013 <li><a href="#animations">Customize Your Animations</a></li>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070014</ol>
15</div>
16</div>
17
18<p>To create apps with material design:</p>
Robert Ly20555292014-06-13 23:28:19 -070019
20<ol>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070021 <li style="margin-bottom:10px">
Ricardo Cervera6dacb262014-06-19 14:40:37 -070022 Take a look at the <a href="http://www.google.com/design/spec">material design
23 specification</a>.</li>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070024 <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 Cervera6dacb262014-06-19 14:40:37 -070031 Specify the <strong>elevation</strong> of your views to cast appropriate shadows.</li>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070032 <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 Cervera6dacb262014-06-19 14:40:37 -070035 Use the new APIs to customize the <strong>animations</strong> in your app.</li>
Robert Ly20555292014-06-13 23:28:19 -070036</ol>
37
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070038<h3>Update Your App for the Android L Developer Preview</h3>
Robert Ly20555292014-06-13 23:28:19 -070039
40<p>To update an existing app for the Android L Developer Preview, design new layouts following
41material design guidelines and consider how you can improve the user experience for your app by
42incorporating depth, touch feedback and animations in your UI.</p>
43
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070044<h3>Create New Apps for the Android L Developer Preview</h3>
Robert Ly20555292014-06-13 23:28:19 -070045
Ricardo Cervera6dacb262014-06-19 14:40:37 -070046<p>If you are creating a new app for the Android L Developer Preview, the <a
47href="http://www.google.com/design/spec">material design guidelines</a> provide you with a
48cohesive design framework for your app. Follow these guidelines and
Robert Ly20555292014-06-13 23:28:19 -070049use the new functionality in the Android framework to design and develop your app.</p>
50
51
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070052<h2 id="applytheme">Apply the Material Theme</h2>
Robert Ly20555292014-06-13 23:28:19 -070053
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070054<p>To apply the material theme in your app, specify a style that inherits from
Ricardo Cervera6dacb262014-06-19 14:40:37 -070055<code>android:Theme.Material</code>:</p>
Robert Ly20555292014-06-13 23:28:19 -070056
57<pre>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070058&lt;!-- res/values/styles.xml -->
Robert Ly20555292014-06-13 23:28:19 -070059&lt;resources>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070060 &lt!-- your app's theme inherits from the Material theme -->
61 &lt;style name="AppTheme" parent="android:Theme.Material">
62 &lt!-- theme customizations -->
Robert Ly20555292014-06-13 23:28:19 -070063 &lt;/style>
64&lt;/resources>
65</pre>
66
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070067<p>The material theme provides new system widgets that let you set their color palette and default
68animations for touch feedback and activity transitions. For more details, see
69<a href="{@docRoot}preview/material/theme.html">Material Theme</a>.</p>
Robert Ly20555292014-06-13 23:28:19 -070070
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070071
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 Cervera6dacb262014-06-19 14:40:37 -070075the <a href="http://www.google.com/design/spec">material design guidelines</a>. When you design
76your layouts, pay special attention to the following:</p>
Robert Ly20555292014-06-13 23:28:19 -070077
78<ul>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070079<li>Baseline grids</li>
80<li>Keylines</li>
81<li>Spacing</li>
82<li>Touch target size</li>
83<li>Layout structure</li>
Robert Ly20555292014-06-13 23:28:19 -070084</ul>
85
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070086
Ricardo Cervera6dacb262014-06-19 14:40:37 -070087<h2 id="depth">Specify Elevation in Your Views</h2>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070088
Ricardo Cervera6dacb262014-06-19 14:40:37 -070089<p>Views can cast shadows, and the elevation value of a view
90determines the size of its shadow and its drawing order. To set the elevation of a view, use the
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070091<code>android:elevation</code> attribute in your layouts:</p>
92
93<pre>
Ricardo Cervera6dacb262014-06-19 14:40:37 -070094&lt;TextView
95 android:id="@+id/my_textview"
Ricardo Cerverad9a70a72014-06-16 12:15:44 -070096 android:layout_width="wrap_content"
97 android:layout_height="wrap_content"
98 android:text="@string/next"
Ricardo Cervera6dacb262014-06-19 14:40:37 -070099 android:background="@color/white"
100 <strong>android:elevation</strong>="5dp" />
Ricardo Cerverad9a70a72014-06-16 12:15:44 -0700101</pre>
102
Ricardo Cervera6dacb262014-06-19 14:40:37 -0700103<p>The new <code>translationZ</code> property lets you create animations that reflect temporary
104changes in the elevation of a view. For example, this is useful to respond to touch gestures.</p>
105
Ricardo Cerverad9a70a72014-06-16 12:15:44 -0700106<p>For more details, see <a href="{@docRoot}preview/material/views-shadows.html">Views and
107Shadows</a>.</p>
108
109
110<h2 id="widgets">Use the New UI Widgets</h2>
111
Ricardo Cervera6dacb262014-06-19 14:40:37 -0700112<p><code>RecyclerView</code> is a more advanced version of <code>ListView</code> that provides
113performance improvements and is easier to use. <code>CardView</code> lets you show pieces of
114information inside cards with a consistent look across apps. To include a <code>CardView</code>
115in your layout:</p>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -0700116
117<pre>
118&lt;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&lt;/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 Cervera6dacb262014-06-19 14:40:37 -0700130<h2 id="animations">Customize Your Animations</h2>
Ricardo Cerverad9a70a72014-06-16 12:15:44 -0700131
132<p>The Android L Developer Preview includes new APIs to create custom animations in your app.
133For example, you can enable activity transitions and define an exit transition inside an
134activity:</p>
135
136<pre>
137// inside your activity
138getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
139
140// set an exit transition
141getWindow().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
147href="{@docRoot}preview/material/animations.html">Animations</a>.</p>