1 page.title= 2 3 @jd:body 4 5 <div id="tb-wrapper"> 6 <div id="tb"> 7 <h2> </h2> 8 <ol> 9 <li><a href="#Theme"> </a></li> 10 <li><a href="#Layouts"> </a></li> 11 <li><a href="#SupportLib"> </a></li> 12 <li><a href="#CheckVersion"> </a></li> 13 </ol> 14 <h2>. </h2> 15 <ul> 16 <li><a href="http://www.google.com/design/spec"> Material Design</a></li> 17 <li><a href="{@docRoot}design/material/index.html">Material Design Android</a></li> 18 </ul> 19 </div> 20 </div> 21 22 23 <p> Material Design, "" , 24 Android 5.0 ( API 21) . , 25 , Material Design, 26 Android.</p> 27 28 29 <h2 id="Theme"> </h2> 30 31 <p> , Material Design , 32 Android . .</p> 33 34 <ol> 35 <li> 36 <code>res/values/styles.xml</code> , (, Holo).</li> 37 <li> 38 <code>res/values-v21/styles.xml</code> , Material Design.</li> 39 <li> .</li> 40 </ol> 41 42 <p class="note"><strong>.</strong> 43 Material Design, , 44 Android, 5.0. 45 </p> 46 47 48 <h2 id="Layouts"> </h2> 49 50 <p> Material Design 51 XML, Android 5.0 ( API 21), 52 Android. . 53 Android.</p> 54 55 <p> Android 5.0 ( API 21) <code>res/layout-v21/</code>, 56 Android ( <code>res/layout/</code>). 57 , <code>res/layout/my_activity.xml</code> 58 <code>res/layout-v21/my_activity.xml</code>.</p> 59 60 <p> , <code>res/values/</code>, 61 <code>res/values-v21/</code> API, , 62 <code>res/values/</code> <code>res/values-v21/</code>.</p> 63 64 65 <h2 id="SupportLib"> </h2> 66 67 <p><a href="{@docRoot}tools/support-library/features.html#v7"> v7</a> 68 r21 Material Design:</p> 69 70 <ul> 71 <li><a href="{@docRoot}training/material/theme.html"> Material Design</a> 72 <code>Theme.AppCompat</code>;</li> 73 <li><a href="{@docRoot}training/material/theme.html#ColorPalette"> </a> 74 <code>Theme.AppCompat</code>;</li> 75 <li> {@link android.support.v7.widget.RecyclerView} <a href="{@docRoot}training/material/lists-cards.html#RecyclerView"> 76 </a>;</li> 77 <li> {@link android.support.v7.widget.CardView} <a href="{@docRoot}training/material/lists-cards.html#CardView"> </a>;</li> 78 <li> {@link android.support.v7.graphics.Palette} <a href="{@docRoot}training/material/drawables.html#ColorExtract"> 79 </a>.</li> 80 </ul> 81 82 <h3> </h3> 83 84 <p> <code>Theme.AppCompat</code> Material Design :</p> 85 86 <ul> 87 <li>{@link android.widget.EditText};</li> 88 <li>{@link android.widget.Spinner};</li> 89 <li>{@link android.widget.CheckBox};</li> 90 <li>{@link android.widget.RadioButton};</li> 91 <li>{@link android.support.v7.widget.SwitchCompat};</li> 92 <li>{@link android.widget.CheckedTextView}.</li> 93 </ul> 94 95 <h3> </h3> 96 97 <p> Material Design 98 Android v7, <code>Theme.AppCompat</code>:</p> 99 100 <pre> 101 <!-- extend one of the Theme.AppCompat themes --> 102 <style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> 103 <!-- customize the color palette --> 104 <item name="colorPrimary">@color/material_blue_500</item> 105 <item name="colorPrimaryDark">@color/material_blue_700</item> 106 <item name="colorAccent">@color/material_green_A200</item> 107 </style> 108 </pre> 109 110 <h3> </h3> 111 112 <p> {@link android.support.v7.widget.RecyclerView} {@link 113 android.support.v7.widget.CardView} Android. 114 Android v7, .</p> 115 <ul> 116 <li> {@link android.support.v7.widget.CardView} 117 .</li> 118 <li> {@link android.support.v7.widget.CardView} , 119 .</li> 120 </ul> 121 122 123 <h3></h3> 124 125 <p> Android, 5.0 ( API 21), 126 Android v7 <a href="{@docRoot}sdk/installing/studio-build.html#dependencies"> Gradle</a>:</p> 127 128 <pre> 129 dependencies { 130 compile 'com.android.support:appcompat-v7:21.0.+' 131 compile 'com.android.support:cardview-v7:21.0.+' 132 compile 'com.android.support:recyclerview-v7:21.0.+' 133 } 134 </pre> 135 136 137 <h2 id="CheckVersion"> </h2> 138 139 <p> Android 5.0 ( API 21) :</p> 140 141 <ul> 142 <li>;</li> 143 <li> ;</li> 144 <li> ;</li> 145 <li> ;</li> 146 <li> ;</li> 147 <li> .</li> 148 </ul> 149 150 <p> Android, {@link 151 android.os.Build.VERSION#SDK_INT version} , API 152 :</p> 153 154 <pre> 155 // Check if we're running on Android 5.0 or higher 156 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 157 // Call some material design APIs here 158 } else { 159 // Implement this feature without material design 160 } 161 </pre> 162 163 <p class="note"><strong>.</strong> Android, , 164 <code>android:minSdkVersion</code> <code>android:targetSdkVersion</code> 165 . Material Design, Android 5.0, 166 <code>android:targetSdkVersion</code> <code>21</code>. . 167 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"> API 168 <uses-sdk></a>.</p> 169