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"> </a></li> 17 <li><a href="{@docRoot}design/material/index.html">Android </a></li> 18 </ul> 19 </div> 20 </div> 21 22 23 <p> Android5.0API 21 24 Android 25 26 </p> 27 28 29 <h2 id="Theme"></h2> 30 31 <p> Android 32 </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> </li> 39 <li> </li> 40 </ol> 41 42 <p class="note"><strong>:</strong> 5.0 Android 43 44 45 </p> 46 47 48 <h2 id="Layouts"></h2> 49 50 <p> Android 5.0API 21 XML Android 51 52 XML Android 53 </p> 54 55 <p>Android 5.0API 21 <code>res/layout-v21/</code> Android 56 <code>res/layout/</code> 57 <code>res/layout/my_activity.xml</code> <code>res/layout-v21/my_activity.xml</code> 58 </p> 59 60 <p><code>res/values/</code> <code>res/values-v21/</code> API <code>res/values/</code> <code>res/values-v21/</code> 61 62 </p> 63 64 65 <h2 id="SupportLib"> </h2> 66 67 <p><a href="{@docRoot}tools/support-library/features.html#v7">v7 </a> r21 68 </p> 69 70 <ul> 71 <li><code>Theme.AppCompat</code> <a href="{@docRoot}training/material/theme.html"> </a> 72 </li> 73 <li><code>Theme.AppCompat</code> <a href="{@docRoot}training/material/theme.html#ColorPalette"> </a> 74 </li> 75 <li><a href="{@docRoot}training/material/lists-cards.html#RecyclerView"> </a> {@link android.support.v7.widget.RecyclerView} 76 </li> 77 <li><a href="{@docRoot}training/material/lists-cards.html#CardView"></a> {@link android.support.v7.widget.CardView} </li> 78 <li><a href="{@docRoot}training/material/drawables.html#ColorExtract"></a> {@link android.support.v7.graphics.Palette} 79 </li> 80 </ul> 81 82 <h3> </h3> 83 84 <p><code>Theme.AppCompat</code> </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>Android v7 <code>Theme.AppCompat</code> 98 </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 v7 Android 114 </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>5.0API 21 Android Android v7 <a href="{@docRoot}sdk/installing/studio-build.html#dependencies">Gradle </a> 126 </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.0API 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 API {@link 151 android.os.Build.VERSION#SDK_INT version} 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 <code>android:minSdkVersion</code> <code>android:targetSdkVersion</code> 164 165 Android 5.0 <code>android:targetSdkVersion</code> <code>21</code> 166 <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html"><uses-sdk> API </a> 167 168 </p> 169