1 page.title=iu khin Nhp liu 2 parent.title=Giao din Ngi dng 3 parent.link=index.html 4 @jd:body 5 6 <div class="figure" style="margin:0"> 7 <img src="{@docRoot}images/ui/ui-controls.png" alt="" style="margin:0" /> 8 </div> 9 10 <p>iu khin nhp liu l nhng thnh phn tng tc trong giao din ngi dng ca ng dng ca bn. Android cung cp 11 nhiu kiu iu khin bn c th s dng trong UI ca mnh, chng hn nh nt, trng vn bn, thanh tm kim, 12 hp kim, nt thu phng, nt bt tt, v nhiu kiu khc.</p> 13 14 <p>Thm mt iu khin nhp liu vo UI ca bn cng n gin nh thm mt phn t XML vo <a href="{@docRoot}guide/topics/ui/declaring-layout.html">b tr XML</a> ca bn. V d, y l mt b tr 15 vi mt trng vn bn v nt:</p> 16 17 <pre style="clear:right"> 18 <?xml version="1.0" encoding="utf-8"?> 19 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 20 android:layout_width="fill_parent" 21 android:layout_height="fill_parent" 22 android:orientation="horizontal"> 23 <EditText android:id="@+id/edit_message" 24 android:layout_weight="1" 25 android:layout_width="0dp" 26 android:layout_height="wrap_content" 27 android:hint="@string/edit_message" /> 28 <Button android:id="@+id/button_send" 29 android:layout_width="wrap_content" 30 android:layout_height="wrap_content" 31 android:text="@string/button_send" 32 android:onClick="sendMessage" /> 33 </LinearLayout> 34 </pre> 35 36 <p>Mi iu khin nhp liu h tr mt tp hp s kin nhp liu c th bn c th x l cc s kin chng hn nh khi 37 ngi dng nhp vn bn hoc chm vo mt nt.</p> 38 39 40 <h2 id="CommonControls">iu khin Thng dng</h2> 41 <p>Sau y l danh sch nhng iu khin thng dng m bn c th s dng trong ng dng ca mnh. Theo di cc lin kt tm 42 hiu thm v vic s dng tng iu khin.</p> 43 44 <p class="note"><strong>Lu :</strong> Android cung cp nhiu iu khin hn mt cht so vi lit k 45 y. Duyt gi {@link android.widget} khm ph thm. Nu ng dng ca bn yu cu mt 46 kiu iu khin nhp liu c th, bn c th xy dng <a href="{@docRoot}guide/topics/ui/custom-components.html">cc thnh phn ty chnh</a> ca chnh mnh.</p> 47 48 <table> 49 <tr> 50 <th scope="col">Kiu iu khin</th> 51 <th scope="col">M t</th> 52 <th scope="col">Lp Lin quan</th> 53 </tr> 54 <tr> 55 <td><a href="controls/button.html">Nt</a></td> 56 <td>Nt nhn c th c nhn, hoc nhp vo, bi ngi dng thc hin mt hnh ng.</td> 57 <td>{@link android.widget.Button Button} </td> 58 </tr> 59 <tr> 60 <td><a href="controls/text.html">Trng vn bn</a></td> 61 <td>Trng vn bn c th chnh sa. Bn c th s dng widget <code>AutoCompleteTextView</code> to mt widget mc nhp vn bn nhm cung cp cc gi t ng hon thnh</td> 62 <td>{@link android.widget.EditText EditText}, {@link android.widget.AutoCompleteTextView}</td> 63 </tr> 64 <tr> 65 <td><a href="controls/checkbox.html">Hp kim</a></td> 66 <td>Mt cng tc bt/tt m c th c chuyn i bi ngi dng. Bn nn s dng cc hp kim khi trnh by cho ngi dng mt nhm cc ty chn c th chn m khng loi tr ln nhau.</td> 67 <td>{@link android.widget.CheckBox CheckBox} </td> 68 </tr> 69 <tr> 70 <td><a href="controls/radiobutton.html">Nt chn mt</a></td> 71 <td>Tng t nh hp kim, ch khc ch ch c th chn mt ty chn trong nhm.</td> 72 <td>{@link android.widget.RadioGroup RadioGroup} 73 <br>{@link android.widget.RadioButton RadioButton} </td> 74 </tr> 75 <tr> 76 <td><a href="controls/togglebutton.html" style="white-space:nowrap">Nt bt tt</a></td> 77 <td>Mt nt bt/tt c n ch bo.</td> 78 <td>{@link android.widget.ToggleButton ToggleButton} </td> 79 </tr> 80 <tr> 81 <td><a href="controls/spinner.html">Quay trn</a></td> 82 <td>Mt danh sch th xung cho php ngi dng chn mt gi tr t mt tp hp.</td> 83 <td>{@link android.widget.Spinner Spinner} </td> 84 </tr> 85 <tr> 86 <td><a href="controls/pickers.html">B chn</a></td> 87 <td>Mt hp thoi cho ngi dng chn mt gi tr n l cho mt tp hp bng cch s dng cc nt ln/xung hoc thng qua c ch trt nhanh. S dng mt widget <code>DatePicker</code> nhp gi tr cho ngy (thng, ngy, nm) hoc mt widget <code>TimePicker</code> nhp gi tr cho thi gian (gi, pht, Sng/Chiu ti) m s c nh dng t ng theo bn a ca ngi dng.</td> 88 <td>{@link android.widget.DatePicker}, {@link android.widget.TimePicker}</td> 89 </tr> 90 </table> 91