1 page.title=Bt u 2 3 @jd:body 4 5 <div id="tb-wrapper"> 6 <div id="tb"> 7 <h2>Bi hc ny hng dn bn cch</h2> 8 <ol> 9 <li><a href="#ApplyTheme">p dng Ch Material</a></li> 10 <li><a href="#Layouts">Thit k B tr ca Bn</a></li> 11 <li><a href="#Depth">Quy nh cao trong Dng xem ca Bn</a></li> 12 <li><a href="#ListsCards">To Danh sch v Th</a></li> 13 <li><a href="#Animations">Ty chnh Hot hnh ca Bn</a></li> 14 </ol> 15 <h2>Bn cng nn c</h2> 16 <ul> 17 <li><a href="http://www.google.com/design/spec">c t phong cch Material Design</a></li> 18 <li><a href="{@docRoot}design/material/index.html">Material Design trn Android</a></li> 19 </ul> 20 </div> 21 </div> 22 23 24 <p> to ng dng vi material design:</p> 25 26 <ol> 27 <li style="margin-bottom:10px"> 28 Xem phn <a href="http://www.google.com/design/spec">c t phong cch material design</a>.</li> 29 <li style="margin-bottom:10px"> 30 p dng ch <strong>material</strong> cho ng dng ca bn.</li> 31 <li style="margin-bottom:10px"> 32 To <strong>b tr</strong> ca bn theo hng dn v material design.</li> 33 <li style="margin-bottom:10px"> 34 Quy nh <strong> cao</strong> cho dng xem ca bn bng.</li> 35 <li style="margin-bottom:10px"> 36 S dng <strong>widget</strong> h thng cho danh sch v th.</li> 37 <li style="margin-bottom:10px"> 38 Ty chnh <strong>hot hnh</strong> trong ng dng ca bn.</li> 39 </ol> 40 41 <h3>Duy tr tnh tng thch ngc</h3> 42 43 <p>Bn c th thm nhiu tnh nng material design vo ng dng ca mnh trong khi vn duy tr tnh tng thch vi 44 cc phin bn Android trc 5.0. bit thm thng tin, hy xem phn 45 <a href="{@docRoot}training/material/compatibility.html">Duy tr Tnh tng thch</a>.</p> 46 47 <h3>Cp nht ng dng ca bn vi material design</h3> 48 49 <p> cp nht mt ng dng hin ti bng material design, hy cp nht cc b tr ca bn theo 50 hng dn v material design. Cng nh kt hp chiu su, phn hi chm v 51 hot hnh.</p> 52 53 <h3>To ng dng mi vi material design</h3> 54 55 <p>Nu bn to mt ng dng mi vi cc tnh nng ca material design, <a href="http://www.google.com/design/spec">hng dn v material design</a> cung cp cho bn mt 56 khun kh thit k sc tch. Lm theo hng dn v s dng chc nng mi trong khun kh Android 57 thit k v pht trin ng dng ca bn.</p> 58 59 60 <h2 id="ApplyTheme">p dng Ch Material</h2> 61 62 <p> p dng ch material trong ng dng ca mnh, hy quy nh mt kiu k tha t 63 <code>android:Theme.Material</code>:</p> 64 65 <pre> 66 <!-- res/values/styles.xml --> 67 <resources> 68 <!-- your theme inherits from the material theme --> 69 <style name="AppTheme" parent="android:Theme.Material"> 70 <!-- theme customizations --> 71 </style> 72 </resources> 73 </pre> 74 75 <p>Ch material cung cp cc widget h thng c cp nht bn c th t bng mu v 76 hot hnh mc nh cho phn hi chm v chuyn tip hot ng. bit thm chi tit, hy xem phn 77 <a href="{@docRoot}training/material/theme.html">S dng Ch Material</a>.</p> 78 79 80 <h2 id="Layouts">Thit k B tr ca Bn</h2> 81 82 <p>Bn cnh vic p dng v ty chnh ch material, b tr ca bn cn tun th 83 <a href="http://www.google.com/design/spec">hng dn v material design</a>. Khi thit k 84 b tr ca bn, hy c bit ch ti iu sau y:</p> 85 86 <ul> 87 <li>Li ng c s</li> 88 <li>Dng chnh</li> 89 <li>Gin cch</li> 90 <li>Kch c mc tiu chm</li> 91 <li>Cu trc b tr</li> 92 </ul> 93 94 95 <h2 id="Depth">Quy nh cao trong Dng xem ca Bn</h2> 96 97 <p>Dng xem c th bng v gi tr cao ca mt dng xem 98 xc nh kch c bng v th t v ca n. t cao ca mt dng xem, hy s dng thuc tnh 99 <code>android:elevation</code> trong b tr ca bn:</p> 100 101 <pre> 102 <TextView 103 android:id="@+id/my_textview" 104 android:layout_width="wrap_content" 105 android:layout_height="wrap_content" 106 android:text="@string/next" 107 android:background="@color/white" 108 android:elevation="5dp" /> 109 </pre> 110 111 <p>Thuc tnh <code>translationZ</code> mi cho php bn to nhng hot hnh phn nh cc thay i 112 tm thi v cao ca mt dng xem. Thay i v cao c th hu ch khi 113 <a href="{@docRoot}training/material/animations.html#ViewState">phn hi li cc c ch 114 chm</a>.</p> 115 116 <p> bit thm chi tit, hy xem phn <a href="{@docRoot}training/material/shadows-clipping.html">nh ngha 117 bng v Dng xem Ct hnh</a>.</p> 118 119 120 <h2 id="ListsCards">To Danh sch v Th</h2> 121 122 <p>{@link android.support.v7.widget.RecyclerView} l mt phin bn d ghp ni hn ca {@link 123 android.widget.ListView} c h tr cc kiu b tr khc nhau v cung cp nhng ci tin v hiu nng. 124 {@link android.support.v7.widget.CardView} cho php bn hin cc mu thng tin bn trong th vi 125 mt din mo nht qun gia cc ng dng. V d v m sau y minh ha cch thm 126 {@link android.support.v7.widget.CardView} vo b tr ca bn:</p> 127 128 <pre> 129 <android.support.v7.widget.CardView 130 android:id="@+id/card_view" 131 android:layout_width="200dp" 132 android:layout_height="200dp" 133 card_view:cardCornerRadius="3dp"> 134 ... 135 </android.support.v7.widget.CardView> 136 </pre> 137 138 <p> bit thm thng tin, hy xem phn <a href="{@docRoot}training/material/lists-cards.html">To Danh sch 139 v Th</a>.</p> 140 141 142 <h2 id="Animations">Ty chnh Hot hnh ca Bn</h2> 143 144 <p>Android 5.0 (API mc 21) bao gm cc API mi to hot hnh ty chnh trong ng dng ca bn. 145 V d, bn c th cho php chuyn tip hot ng v nh ngha mt chuyn tip ra bn trong mt 146 hot ng:</p> 147 148 <pre> 149 public class MyActivity extends Activity { 150 151 @Override 152 protected void onCreate(Bundle savedInstanceState) { 153 super.onCreate(savedInstanceState); 154 // enable transitions 155 getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); 156 setContentView(R.layout.activity_my); 157 } 158 159 public void onSomeButtonClicked(View view) { 160 getWindow().setExitTransition(new Explode()); 161 Intent intent = new Intent(this, MyOtherActivity.class); 162 startActivity(intent, 163 ActivityOptions 164 .makeSceneTransitionAnimation(this).toBundle()); 165 } 166 } 167 </pre> 168 169 <p>Khi bn bt u mt hot ng khc t hot ng ny, chuyn tip ra c kch hot.</p> 170 171 <p> tm hiu thm v cc API hot hnh mi, hy xem <a href="{@docRoot}training/material/animations.html">nh ngha Hot hnh Ty chnh</a>.</p> 172