1 page.title=iu hng bng Quay li v Ln trn 2 page.tags="navigation","activity","task","up navigation","back navigation" 3 page.image=/design/media/navigation_between_siblings_gmail.png 4 @jd:body 5 6 <a class="notice-developers" href="{@docRoot}training/implementing-navigation/index.html"> 7 <div> 8 <h3>Ti liu cho Nh pht trin</h3> 9 <p>Trin khai iu hng Hiu qu</p> 10 </div> 11 </a> 12 13 <p itemprop="description">iu hng nht qun l mt thnh phn thit yu trong tri nghim ngi dng ni chung. Mt vi iu nh b li khin 14 ngi dng kh chu hn so vi iu hng c bn chnh l hnh x khng nht qun v khng nh k vng. Android 3.0 15 gii thiu nhng thay i ng k v hnh vi iu hng ton cc. Tun th k lng cc hng dn 16 v Quay li v Ln trn s gip vic iu hng trn ng dng ca bn tr nn d on v ng tin cy cho ngi dng ca bn.</p> 17 <p>Phin bn Android 2.3 v mi hn da vo nt <em>Quay li</em> ca h thng h tr iu hng trong mt 18 ng dng. Vi vic gii thiu thanh hnh ng trong Android 3.0, mt c ch iu hng th hai xut hin: 19 nt <em>Ln trn</em>, bao gm biu tng ng dng v du nhy li tri.</p> 20 21 <img src="{@docRoot}design/media/navigation_with_back_and_up.png"> 22 23 <h2 id="up-vs-back">Ln trn so vi Quay li</h2> 24 25 <p>Nt Ln trn c s dng iu hng bn trong mt ng dng da trn mi quan h th bc 26 gia cc mn hnh. V d, nu mn hnh A hin th mt danh sch cc mc v vic chn mt mc s dn n 27 mn hnh B (trnh by chi tit hn v mc ), khi B s a ra nt Ln trn 28 quay li mn hnh A.</p> 29 <p>Nu mt mn hnh ang trn cng trong mt ng dng (c th l trang ch ca ng dng), th n s xut hin nt 30 Ln trn.</p> 31 32 <p>Nt Quay li ca h thng c s dng iu hng ngc theo th t thi gian, qua lch s cc mn hnh 33 m ngi dng mi thao tc qua. N thng c da trn mi quan h thi gian 34 gia cc mn hnh thay v th bc ca ng dng.</p> 35 36 <p>Khi mn hnh xem trc cng ng thi l mn hnh m theo th bc ca mn hnh hin ti, nhn nt 37 Quay li s c cng kt qu nh khi nhn nt Ln trn—iu ny thng hay 38 xy ra. Tuy nhin, khng nh nt Ln trn m bo ngi dng vn cn trong ng dng ca bn, 39 nt Quay li c th tr ngi dng v mn hnh Trang ch hoc thm ch sang mt ng dng khc.</p> 40 41 <img src="{@docRoot}design/media/navigation_up_vs_back_gmail.png"> 42 43 <p>Nt Quay li cng h tr mt vi hnh vi khng trc tip gn vi iu hng gia cc mn hnh: 44 </p> 45 <ul> 46 <li>B qua ca s ni (hp thoi, ca s bt ln)</li> 47 <li>B qua thanh hnh ng ng cnh v b t sng khi mc chn</li> 48 <li>n bn phm trn mn hnh (IME)</li> 49 </ul> 50 <h2 id="within-app">iu hng trong ng dng ca Bn</h2> 51 52 <h4>iu hng ti mn hnh vi nhiu im bt u</h4> 53 <p>i khi mt mn hnh khng ch c mt v tr c nh trong th bc ca ng dng v bn c th truy cp n 54 t nhiu im bt u—v d nh mn hnh ci t c th c truy cp t bt c mn hnh 55 no khc trong ng dng ca bn. Trong trng hp ny, nt Ln trn s chn quay li mn hnh chuyn n, c tc dng 56 ging nh Quay li.</p> 57 <h4>Thay i dng xem bn trong mt mn hnh</h4> 58 <p>Thay i ty chn dng xem cho mt mn hnh khng lm thay i hnh vi Ln trn hay Quay li: mn hnh vn 59 cng mt ch trong th bc ca ng dng v khng to thm lch s iu hng mi no.</p> 60 <p>V d v thay i dng xem gm:</p> 61 <ul> 62 <li>Chuyn dng xem bng tab v/hoc trt nhanh tri phi</li> 63 <li>Chuyn dng xem bng danh sch th xung (cn gi l tab thu gn)</li> 64 <li>Lc mt danh sch</li> 65 <li>Sp xp mt danh sch</li> 66 <li>Thay i c tnh hin th (nh thu phng)</li> 67 </ul> 68 <h4>iu hng gia cc mn hnh anh em</h4> 69 <p>Khi ng dng ca bn h tr iu hng t mt danh mc ti mt dng xem chi tit ca mt trong nhng mc , thng 70 n u tin h tr iu hng theo hng t mc ti mt mc khc pha trc hoc 71 pha sau n trong danh sch. V d, trong Gmail, bn c th d dng trt nhanh sang tri hoc phi t mt hi thoi 72 xem hi thoi mi hn hoc c hn trong cng Hp th n. Nh khi thay i dng xem trong mt mn hnh, 73 iu hng khng lm thay i hnh vi Ln trn hoc Quay li.</p> 74 75 <img src="{@docRoot}design/media/navigation_between_siblings_gmail.png"> 76 77 <p>Tuy nhin, c mt trng hp ngoi l ng ch l khi duyt gia cc dng xem chi tit c lin quan, khng 78 rng buc vi nhau bi danh sch chuyn n—v d nh khi duyt trong Play Store gia cc ng dng t 79 cng mt nh pht trin hoc gia cc album bi cng mt ngh s. Trong cc trng hp ny, truy cp vo tng lin kt khng to ra 80 lch s, khin nt Quay li i qua tng mn hnh c xem trc . Thao tc Ln trn s tip tc 81 b qua nhng mn hnh lin quan ny v iu hng ti mn hnh b cha c xem gn y nht.</p> 82 83 <img src="{@docRoot}design/media/navigation_between_siblings_market1.png"> 84 85 <p>Bn c kh nng thit k hnh vi Ln trn thng minh hn da trn hiu bit ca mnh v dng xem 86 chi tit. Suy rng t v d v Play Store bn trn, tng tng ngi dng iu hng t 87 Cun sch xem gn nht ti chi tit chuyn th Phim. Trong trng hp , thao tc Ln trn c th tr v mt b cha 88 (Phim) m trc ngi dng cha iu hng qua.</p> 89 90 <img src="{@docRoot}design/media/navigation_between_siblings_market2.png"> 91 92 <h2 id="into-your-app">iu hng ti ng dng ca Bn thng qua Widget v Thng bo trn Mn hnh Trang ch</h2> 93 94 <p>Bn c th s dng widget hoc thng bo trn mn hnh Trang ch gip ngi dng ca mnh iu hng trc tip ti mn hnh 95 nm su trong th bc ng dng ca bn. V d, widget Hp th n ca Gmail v thng bo th mi c th 96 va b qua mn hnh Hp th n, va a ngi dng trc tip ti dng xem hi thoi.</p> 97 98 <p>Trong c hai trng hp ny, hy iu khin nt Ln trn nh sau:</p> 99 100 <ul> 101 <li><em>Nu mn hnh ch thng c truy cp t mt mn hnh c th trong ng dng 102 ca bn</em>, thao tc Ln trn s iu hng ti mn hnh .</li> 103 <li><em>Nu khng</em>, thao tc Ln trn s iu hng ti mn hnh trn cng ("Trang ch") ca ng dng ca bn.</li> 104 </ul> 105 106 <p>Trong trng hp nt Quay li, bn nn thit k vic iu hng d on hn bng cch chn vo ngn xp 107 ca tc v ton b ng dn iu hng ln trn ti mn hnh trn cng ca ng dng. Lm vy s cho php nhng ngi dng no 108 qun cch h vo ng dng ca bn s iu hng ti mn hnh trn cng ca ng dng trc khi 109 thot.</p> 110 111 <p>V d, widget mn hnh Trang ch ca Gmail c mt nt i trc tip vo mn hnh 112 son email ca n. Ln hoc Quay li t mn hnh son th s a ngi dng ti Hp th n, v t 113 nt Quay li tip tc a v Trang ch.</p> 114 115 <img src="{@docRoot}design/media/navigation_from_outside_back.png"> 116 117 <h4>Thng bo gin tip</h4> 118 119 <p>Khi ng dng ca bn cn trnh by thng tin v nhiu s kin ng thi, n c th s dng 120 thng bo duy nht chuyn hng ngi dng ti mt mn hnh xen k. Mn hnh ny tng hp nhng s kin 121 ny v cung cp ng dn cho ngi dng i su vo ng dng. Thng bo kiu ny c gi 122 l <em>thng bo gin tip</em>.</p> 123 124 <p>Khng nh thng bo tiu chun (trc tip), nhn Quay li t mn hnh xen k ca mt thng bo gin tip 125 s tr ngi dng v im m t thng bo c kch hot—khng c 126 mn hnh b sung no c chn vo ngn xp. Sau khi ngi dng tin vo ng dng t mn hnh xen k 127 , thao tc Ln trn v Quay li c tc dng nh vi thng bo tiu chun, nh c m t trn: 128 iu hng bn trong ng dng thay v quay li mn hnh xen k.</p> 129 130 <p>V d, gi s mt ngi dng trong Gmail nhn c mt thng bo gin tip t Lch. Chm 131 vo thng bo ny m ra mn hnh xen k, trong hin th nhc nh cho mt vi s kin 132 khc nhau. Chm vo Quay li t mn hnh xen k s tr ngi dng v Gmail. Chm vo mt s kin 133 c th s a ngi dng ra khi mn hnh xen k v vo ng dng Lch hin th chi tit v 134 s kin. T chi tit s kin, Ln trn v Quay li s iu hng ti dng xem trn cng ca Lch.</p> 135 136 <img src="{@docRoot}design/media/navigation_indirect_notification.png"> 137 138 <h4>Thng bo bt ln</h4> 139 140 <p><em>Thng bo bt ln</em> s b qua ngn thng bo thay v xut hin trc tip pha 141 trc ngi dng. Chng him khi c s dng v <strong>nn c dnh cho nhng dp khi cn 142 phn ng kp thi v vic gin on ng cnh ca ngi dng l cn thit</strong>. V d, 143 Talk s dng kiu ny cnh bo ngi dng v li mi t mt ngi bn tham gia tr chuyn video, bi 144 li mi ny s t ng ht hn sau mt vi giy.</p> 145 146 <p>Xt v hnh vi iu hng, thng bo bt ln bm st cht ch hnh vi ca mn hnh xen k 147 trong thng bo gin tip. Quay li s b qua thng bo bt ln. Nu ngi dng iu hng 148 t mn hnh bt ln vo ng dng thng bo, hnh vi Ln trn v Quay li s bm st quy tc p dng vi thng bo tiu chun, 149 iu hng bn trong ng dng.</p> 150 151 <img src="{@docRoot}design/media/navigation_popup_notification.png"> 152 153 <h2 id="between-apps">iu hng gia cc ng dng</h2> 154 155 <p>Mt trong nhng th mnh c bn ca h thng Android l kh nng cc ng dng kch hot 156 ln nhau, gip ngi dng c th iu hng trc tip t ng dng ny sang ng dng khc. V d, mt ng dng 157 cn chp nh c th kch hot ng dng Camera, ng dng ny s tr 158 nh v ng dng chuyn n. iu ny c bit c ch i vi c nh pht trin, nhng ngi c th d dng tn dng 159 on m t cc ng dng khc, ln ngi dng, nhng ngi thch c mt tri nghim nht qun i vi nhng hnh ng 160 c thc hin thng xuyn.</p> 161 162 <p> hiu r iu hng gia cc ng dng, quan trng l phi hiu c hnh vi b khung Android 163 c cp di y.</p> 164 165 <h4>Hot ng, tc v v nh</h4> 166 167 <p>Trong Android, <strong>hot ng</strong> l mt thnh phn ng dng nh ngha mt mn hnh 168 thng tin v tt c hnh ng lin kt m ngi dng c th thc hin. ng dng ca bn l tp hp 169 ca nhiu hot ng, bao gm c hot ng do bn to v hot ng m bn s dng li t cc ng dng khc.</p> 170 171 <p><strong>Tc v</strong> l trnh t cc hot ng m mt ngi dng tun theo hon thnh mt mc tiu. 172 Tc v n c th s dng cc hot ng t ch mt ng dng, hoc c th da trn hot ng t nhiu 173 ng dng khc nhau.</p> 174 175 <p><strong> nh</strong> l mt c ch mt ng dng bo hiu rng n mun s tr gip 176 ca mt ng dng khc khi thc hin mt hnh ng. Cc hot ng ca mt ng dng c th biu th nhng nh 177 m chng c th phn hi. i vi nhng nh thng gp nh "Chia s", ngi dng c th ci t nhiu ng dng 178 c kh nng thc hin yu cu .</p> 179 180 <h4>V d: iu hng gia cc ng dng h tr chia s</h4> 181 182 <p> hiu nhng hot ng, tc v v nh ny vn hnh vi nhau nh th no, hy xem cch mt ng dng cho php ngi dng 183 chia s ni dung bng cch dng mt ng dng khc. V d, khi chy ng dng Play Store t Trang ch s bt u 184 Tc v A mi (xem hnh bn di). Sau khi iu hng qua Play Store v chm vo mt cun sch c qung co 185 xem chi tit ca sch, ngi dng vn trong cng mt tc v, m rng n bng cch thm vo cc hot ng. Kch hot 186 hnh ng Chia s s nhc ngi dng bng mt hp thoi lit k tng hot ng mt (t cc ng dng khc nhau) 187 m ng k x l nh Chia s .</p> 188 189 <img src="{@docRoot}design/media/navigation_between_apps_inward.png"> 190 191 <p>Khi ngi dng chn chia s qua Gmail, hot ng son email ca Gmail s c thm lm hot ng tip tc 192 Tc v A—khng c tc v mi no c to thm. Nu Gmail c tc v ring ang chy nn, n s 193 khng b nh hng.</p> 194 195 <p>T hot ng son email, gi th hoc chm vo nt Quay li s tr ngi dng v 196 hot ng chi tit v cun sch. Nhng ln chm sau vo Quay li s tip tc iu hng quay li qua 197 Store v cui cng v li Trang ch.</p> 198 199 <img src="{@docRoot}design/media/navigation_between_apps_back.png"> 200 201 <p>Tuy nhin, nu chm vo Ln trn t hot ng son email, ngi dng biu th mong mun vn nguyn trong 202 Gmail. Hot ng danh sch hi thoi ca Gmail xut hin v Tc v B mi s c to cho n. Cc tc v mi 203 s lun c lin kt gc vi Trang ch, v th chm vo Quay li t danh sch hi thoi s quay li .</p> 204 205 <img src="{@docRoot}design/media/navigation_between_apps_up.png"> 206 207 <p>Tc v A duy tr chy nn v ngi dng c th quay li n sau (v d, thng qua 208 mn hnh Gn y). Nu Gmail c tc v ring ang chy nn, n s c thay th 209 bng Tc v B—ng cnh trc s b b i phc v cho mc ch mi ca ngi dng.</p> 210 211 <p>Khi ng dng ca bn ng k iu khin nh bng mt hot ng nm su trong th bc ca ng dng, 212 hy tham kho phn <a href="#into-your-app">iu hng ti ng dng ca Bn thng qua Widget v Thng bo trn 213 Mn hnh Trang ch</a> xem hng dn v cch quy nh iu hng Ln trn.</p> 214