Cov txheej txheem:
- Kauj Ruam 1: Tsim Txoj Haujlwm Tshiab
- Kauj ruam 2: Kho qhov Activity_main.xml
- Kauj ruam 3: Tam sim no, Kho qhov MainActivity.java
- Kauj ruam 4: Ua tiav
Video: HelloWorld Nrog Tawm Tawm Khawm AndroidStudio: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-31 10:20
Cov ntawv qhia no yuav qhia koj li cas los tsim Android App uas tso saib Hello World text thiab Exit khawm kom tawm ntawm qhov haujlwm.
Kauj Ruam 1: Tsim Txoj Haujlwm Tshiab
Qhib Android Studio thiab tsim txoj haujlwm tshiab. Npe koj txoj haujlwm tshiab li HelloWorld thiab ntxiv Kev Ua Haujlwm Tsis Txaus.
Kauj ruam 2: Kho qhov Activity_main.xml
Ntxiv cov ntawv nyeem tshiab thiab khawm (raws li qhia hauv qab no) hauv res> layout> activity_main.xml.
android: id = "@+id/btn_logout" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_below = "@+id/textView" android: layout_centerHorizontal = "tseeb" android: text = "Exit" android: textColor = "@xim/dub"/>
Txij li thaum peb siv cov xim rau cov ntawv, ntxiv cov peev txheej tshiab hauv color.xml. Mus rau res> qhov tseem ceeb> xim.xml thiab ntxiv cov cai hauv qab no
#0d0c0c>
Kauj ruam 3: Tam sim no, Kho qhov MainActivity.java
Ntxiv cov cai hauv qab no rau OnCreate () txoj hauv kev MainActivity.java
Peb ntxiv OnClickListener ua haujlwm rau lub pob yog li thaum twg tus neeg siv tau nyem rau ntawm lub pob qhov kev sib tham yuav tshwm nrog qhov ceeb toom "Koj puas xav tawm?". Ob txoj kev xaiv yuav muab rau tus neeg siv, "Yog …" kom tawm thiab "Tsis yog …" kaw qhov kev sib tham thiab rov qab mus rau qhov tseem ceeb.
Khawm btnlogout = (Khawm) findViewById (R.id.btn_logout);
btnlogout.setOnClickListener (Saib tshiab. OnClickListener () {@Override pej xeem void onClick (Saib pom) {zaum kawg AlertDialog. Builder builder = tshiab AlertDialog. Builder (MainActivity.this); builder.setTitle ("Tawm"); builder.setMessage ("Koj puas xav tawm ??"); builder.setPositiveButton ("Yog. Tawm tam sim no!", Tshiab DialogInterface. OnClickListener () {@Override pej xeem void onClick (DialogInterface dialogInterface, int i) tiav ();}}); builder.setNegativeButton ("Tsis yog tam sim no", DialogInterface tshiab. OnClickListener () {@Override pej xeem void onClick (DialogInterface dialogInterface, int i) dialogInterface.dismiss ();}}); AlertDialog dialog = builder.create (); dialog.sh ();}});
Kauj ruam 4: Ua tiav
Tam sim no, koj tuaj yeem khiav lub app.
Hmoov zoo
Cov lej tag nrho nyob ntawm no:
Pom zoo:
Yuav Ua Li Cas Thiaj Li Tawm Tawm Tawm Tawm Rau Hauv Kev Hloov Pauv Hloov?: 6 Cov Kauj Ruam
Yuav Ua Li Cas Thiaj Li Ua Tus Tawm Tawm Tawm Rau Hauv Kev Hloov Transformer?: Yog tias koj xav tau tus tswv lub zog hloov pauv, tom qab ntawd koj yuav tsum tau nyeem kab lus no. Peb yuav xav ua kom tus neeg hloov pauv ntawm txhais ceg txav mus, ua haujlwm yooj yim thiab hais ob peb yam, lossis tseem paub yuav ua li cas sawv, zaum thiab yoj tes. Lub zog los ntawm
Kho Ob Chav Tawm Tawm Tawm Tawm Tawm Cov Khoom Siv Hluav Taws Xob: 10 Cov Kauj Ruam (nrog Duab)
Kho Ob Chav Tawm Tawm Tawm Tawm Tawm Tawm Cov Khoom Siv Hluav Taws Xob: Nta: AC-DC Hloov pauv ob npaug tso tawm qhov hluav taws xob (Zoo-Hauv av-Tsis Zoo) Kho txoj kab zoo thiab tsis zoo Tsuas yog Ib Leeg Ib Leeg AC hloov pauv cov suab nrov (20MHz-BWL, tsis muaj thauj khoom): Ib puag ncig 1.12mVpp Tsawg suab nrov thiab cov txiaj ntsig ruaj khov (zoo tagnrho
Rooj Bluetooth Hais Lus Nrog Pom Pom Lub Suab, Khawm Khawm thiab NFC.: 24 Kauj Ruam (nrog Duab)
Rooj Bluetooth Hais Lus Nrog Pom Pom Suab, Khawm Khawm thiab NFC.: Nyob zoo! Hauv Cov Lus Qhia no Kuv yuav qhia yuav ua li cas kuv thiaj ua Lub Rooj Sib Tham Bluetooth hais lus no uas muaj Lub Suab Pom Zoo Zoo nrog kov cov nyees khawm thiab NFC. Ua tau yooj yim ua ke nrog NFC Enabled cov cuab yeej nrog tsuas yog kov. Tsis muaj lub cev khawm
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Suab Tawm Tswv Yim thiab Tso Tawm: 13 Kauj Ruam
Yuav Ua Li Cas Txuas Lub Laub Khawm Nrog Lub Suab Tawm Tawm thiab Tawm Tawm: Lub laub khawm yog ib qho ntawm cov hauv paus tseem ceeb rau kev ntes koj qhov kev ua. Koj tuaj yeem thawb lub pob kom ua ib yam dab tsi. Muaj ntau txoj hauv kev los siv cov nyees khawm hauv koj cov phiaj xwm (piv txwv li nyiag nkas nas thiab keyboard, lossis Arduino, gainer, MCK). Tsi
Yuav Ua Li Cas Txuas Tus Fader Nrog Kev Tawm Suab thiab Tawm Tawm: 14 Cov Kauj Ruam
Yuav Ua Li Cas Txuas Tus Fader Nrog Suab Tawm Tswv Yim thiab Tawm Tawm: Tus fader yog ib qho ntawm cov hauv paus ntsiab lus rau kev sib xyaw ua ke. Koj tuaj yeem tswj hwm koj lub hauv paus nrog kev txav ntawm fader. Muaj ntau txoj hauv kev los siv cov khawm thawb hauv koj cov phiaj xwm (piv txwv li nyiag nkas nas thiab keyboard, lossis Arduino, tau txais, MC