Dab tsi yog kev siv fragment hauv Android?
Dab tsi yog kev siv fragment hauv Android?

Video: Dab tsi yog kev siv fragment hauv Android?

Video: Dab tsi yog kev siv fragment hauv Android?
Video: Qhia saib yus tus hlub lub xov tooj seb nws kov txog dab tsi thaum yus nyob deb 2024, Kaum ib hlis
Anonim

A tawg tawg yog ib qho kev ywj pheej Android tivthaiv uas tuaj yeem siv los ntawm kev ua haujlwm. A tawg tawg encapsulates functionality kom nws yooj yim dua rau rov siv dua nyob rau hauv kev ua ub no thiab layouts. A tawg tawg khiav hauv cov ntsiab lus ntawm kev ua ub no, tab sis nws muaj nws lub neej voj voog thiab feem ntau nws tus kheej siv interface.

Ib yam li ib tug yuav nug, dab tsi yog qhov tawg hauv Android?

Fragments Ib feem ntawm Android Dav hlau. A Fragment sawv cev rau tus cwj pwm lossis ib feem ntawm cov neeg siv interface hauv FragmentActivity. Koj tuaj yeem ua ke ntau qhov tawg hauv ib qho kev ua si los tsim kom muaj ntau lub pane UI thiab rov siv dua a tawg tawg hauv ntau yam dej num.

Kuj Paub, cov fragments ua haujlwm li cas? Peb ua tau siv Android Kev txhawb nqa Studio hauv Kev Tsim Tsim rau cov ntaub ntawv MainActivity layout xaiv a tawg tawg los ntawm sab hauv cov kev cai xaiv. Qhib cov ntaub ntawv activ_main layout hauv kev tsim saib thiab, hauv Palete, nyem Fragment nyob rau hauv seem "Custom". Koj yuav raug ceeb toom kom xaiv ib tawg tawg.

Tom qab ntawd, ib tus tuaj yeem nug, dab tsi yog qhov tawg thiab kev ua haujlwm hauv Android?

Fragment yog ib feem ntawm ib kev ua si , uas txhawb nws tus kheej UI rau qhov ntawd kev ua si . Fragment tuaj yeem xav zoo li sub kev ua si , whereas lub ua tiav screen uas cov neeg siv interacts hu ua kev ua si . Ib kev ua si tuaj yeem muaj ntau yam tawg tawg.

Qhov piv txwv ntawm fragment yog dab tsi?

Definition of ib kab lus Fragment Rau piv txwv , 'Kuv nyiam cheeseburgers' yog ib qho kev ywj pheej. Kab lus tawg tawg yeej tsis muaj kev ywj pheej clauses, tab sis es tsis txhob yog dependent clauses los yog kab lus. Fragments tuaj yeem tsim cov kab lus tiag tiag vim lawv pib nrog tsab ntawv loj thiab xaus nrog lub sijhawm.

Pom zoo: