日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
鴻蒙HarmonyOS北向應(yīng)用開發(fā)者極速入門教程(一)續(xù)-實(shí)戰(zhàn)練習(xí)篇1

 想了解更多內(nèi)容,請(qǐng)?jiān)L問:

和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos./#zz

三、實(shí)戰(zhàn)練習(xí)

截圖另外做文檔答題。文檔要求,文件名:某某研究日志日期。文件內(nèi)容,題目和答題,截圖代碼和文字等綜合展示。

1.練習(xí)題一

以下是基于DevEco Studio蛟龍騰飛北向應(yīng)用開發(fā)工程師已經(jīng)實(shí)現(xiàn)的布局、功能、代碼及路徑,請(qǐng)安裝要求一模一樣的流程和效果,在自己的DevEco Studio實(shí)現(xiàn)。這里我們可以自行選擇自己想開發(fā)的設(shè)備和模板,這里我們以Phone為例,開發(fā)模板選擇空特性java的開發(fā)模板,點(diǎn)擊next進(jìn)行下一步。

開發(fā)的設(shè)備有七種:

  • Phone
  • Tablet
  • Car
  • Tv
  • Wearable
  • Lite wearable
  • smart vision

Phone設(shè)備中有很多種不同的模板,主要是java和js進(jìn)行開發(fā)以及不同的模板樣式,不同樣式之間布局不一樣,不同的布局所展示的效果代碼已經(jīng)寫入其中,只需要加入想加入的元素即可。

選擇好了之后點(diǎn)擊next進(jìn)行下一步。

這里是創(chuàng)建項(xiàng)目的一些項(xiàng)目配置,配置完成點(diǎn)擊Finish完成創(chuàng)建。

完成創(chuàng)建后,我們進(jìn)入了主界面,這里需要等待一小會(huì),因?yàn)橐恍┡渲脰|西在進(jìn)行下載配置。

Phone模擬器上的代碼案例:

顯示效果:

雙擊圖中選中的設(shè)備就可以運(yùn)行了。

顯示如下:

運(yùn)行效果:

點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面:

代碼如下:

第一個(gè)布局中

 
 
 
 
  1.     xmlns:ohos="http://schemas.huawei.com/res/ohos"
  2.     ohos:height="match_parent"
  3.     ohos:width="match_parent"
  4.     ohos:orientation="vertical">
  5.     
  6.         ohos:width="match_parent"
  7.         ohos:weight="1">
  8.         
  9.             ohos:width="match_content"
  10.             ohos:height="match_content"
  11.             ohos:text="蛟龍騰飛"
  12.             ohos:text_size="80px"
  13.             ohos:top_margin="280px"
  14.             ohos:left_margin="50px"/>
  15.     
  16.     
  17.         ohos:weight="1"
  18.         ohos:width="match_parent">
  19.         
  20.             ohos:width="1080px"
  21.             ohos:height="468px"
  22.             ohos:image_src="$media:index12.jpg"/>
  23.     
  24.     
  25.         ohos:width="match_parent"
  26.         ohos:weight="3">
  27.         
  28.             ohos:width="match_content"
  29.             ohos:height="match_content"
  30.             ohos:text_size="60px"
  31.             ohos:multiple_lines="true"
  32.             ohos:left_margin="8px"
  33.             ohos:text="帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互聯(lián)網(wǎng)時(shí)代"/>
  34.         
  35.             ohos:width="match_content"
  36.             ohos:height="match_content"
  37.             ohos:text_size="60px"
  38.             ohos:multiple_lines="true"
  39.             ohos:left_margin="8px"
  40.             ohos:top_margin="10px"
  41.             ohos:text="跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智能世界!"/>
  42.         
  43.             ohos:width="match_content"
  44.             ohos:height="match_content"
  45.             ohos:text_size="60px"
  46.             ohos:multiple_lines="true"
  47.             ohos:left_margin="8px"
  48.             ohos:top_margin="10px"
  49.             ohos:text="馬上創(chuàng)建體驗(yàn)個(gè)人、公司或組織的鴻蒙應(yīng)用吧!"/>
  50.         
  51.             ohos:id="$+id:jltfbutton"
  52.             ohos:width="match_content"
  53.             ohos:height="match_content"
  54.             ohos:text="點(diǎn)擊了解更多"
  55.             ohos:text_color="red"
  56.             ohos:text_size="100px"
  57.             ohos:top_margin="400px"
  58.             ohos:left_margin="420px"/>
  59.     

 第二個(gè)布局中

 
 
 
 
  1.     xmlns:ohos="http://schemas.huawei.com/res/ohos"
  2.     ohos:height="match_parent"
  3.     ohos:width="match_parent"
  4.     ohos:orientation="vertical">
  5.     
  6.         ohos:width="match_parent"
  7.         ohos:weight="1">
  8.         
  9.             ohos:width="match_content"
  10.             ohos:height="match_content"
  11.             ohos:text="蛟龍騰飛"
  12.             ohos:text_size="80px"
  13.             ohos:top_margin="280px"
  14.             ohos:left_margin="50px"/>
  15.     
  16.     
  17.         ohos:weight="1"
  18.         ohos:width="match_parent">
  19.         
  20.             ohos:width="1080px"
  21.             ohos:height="468px"
  22.             ohos:image_src="$media:index13.jpg"/>
  23.     
  24.     
  25.         ohos:width="match_parent"
  26.         ohos:weight="3">
  27.         
  28.             ohos:width="match_content"
  29.             ohos:height="match_content"
  30.             ohos:text_size="60px"
  31.             ohos:multiple_lines="true"
  32.             ohos:left_margin="8px"
  33.             ohos:text="你好,歡迎來(lái)到鴻蒙時(shí)代!"/>
  34.         
  35.             ohos:width="match_content"
  36.             ohos:height="match_content"
  37.             ohos:text_size="60px"
  38.             ohos:multiple_lines="true"
  39.             ohos:left_margin="8px"
  40.             ohos:top_margin="10px"
  41.             ohos:text="蛟龍騰飛,鴻蒙先行者,全心全意為你"/>
  42.         
  43.             ohos:width="match_content"
  44.             ohos:height="match_content"
  45.             ohos:text_size="60px"
  46.             ohos:multiple_lines="true"
  47.             ohos:left_margin="10px"
  48.             ohos:top_margin="10px"
  49.             ohos:text="提供鴻蒙各項(xiàng)服務(wù)! 馬上咨詢:李先生 13725519713 或 18138827525"/>
  50.     

 在slice文件的類中添加點(diǎn)擊事件進(jìn)行跳轉(zhuǎn):

 
 
 
 
  1. Button button = (Button) findComponentById(ResourceTable.Id_jltfbutton);
  2. button.setClickedListener(new Component.ClickedListener() {
  3.     @Override
  4.     public void onClick(Component component) {
  5.         present(new JltfAbilitySlice(),new Intent());
  6.     }
  7. });

 TV模擬器上的代碼案例:

新建項(xiàng)目選擇模板進(jìn)行下一步。

顯示效果:

點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面。

代碼如下:

第一個(gè)頁(yè)面中的布局

 
 
 
 
  1.     xmlns:ohos="http://schemas.huawei.com/res/ohos"
  2.     ohos:height="match_parent"
  3.     ohos:width="match_parent"
  4.     ohos:orientation="vertical">
  5.    
  6.        ohos:width="match_parent"
  7.        ohos:height="160px"
  8.        >
  9.        
  10.            ohos:width="match_content"
  11.            ohos:height="match_content"
  12.            ohos:text="蛟龍騰飛"
  13.            ohos:text_size="25fp"
  14.            ohos:top_margin="40px"
  15.            ohos:left_margin="40px"/>
  16.    
  17.     
  18.         ohos:width="match_parent"
  19.         ohos:height="920px"
  20.         ohos:orientation="horizontal">
  21.         
  22.             ohos:height="match_parent"
  23.             ohos:width="820px">
  24.             
  25.                 ohos:width="600px"
  26.                 ohos:height="600px"
  27.                 ohos:top_margin="60px"
  28.                 ohos:left_margin="100px"
  29.                 ohos:image_src="$media:index6"/>
  30.         
  31.         
  32.             ohos:height="match_parent"
  33.             ohos:width="1100px">
  34.             
  35.                 ohos:width="match_content"
  36.                 ohos:height="match_content"
  37.                 ohos:multiple_lines="true"
  38.                 ohos:text="帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互聯(lián)網(wǎng)時(shí)代
  39.                                跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智能世界!
  40.                                     馬上創(chuàng)建體驗(yàn)個(gè)人、公司或組織的鴻蒙應(yīng)用吧!"
  41.                 ohos:text_size="25fp"
  42.                 ohos:top_margin="240px"
  43.                 ohos:left_margin="10px"/>
  44.             
  45.                 ohos:id="$+id:jltfbutton"
  46.                 ohos:width="match_content"
  47.                 ohos:height="match_content"
  48.                 ohos:text="點(diǎn)擊了解更多"
  49.                 ohos:text_size="30fp"
  50.                 ohos:top_margin="290px"
  51.                ohos:left_margin="680px"
  52.                 ohos:text_color="red"/>
  53.         
  54.     

 第二個(gè)頁(yè)面中的布局

 
 
 
 
  1.     xmlns:ohos="http://schemas.huawei.com/res/ohos"
  2.     ohos:height="match_parent"
  3.     ohos:width="match_parent"
  4.     ohos:orientation="vertical">
  5.     
  6.         ohos:width="match_parent"
  7.         ohos:height="160px"
  8.         >
  9.         
  10.             ohos:width="match_content"
  11.             ohos:height="match_content"
  12.             ohos:text="蛟龍騰飛"
  13.             ohos:text_size="25fp"
  14.             ohos:top_margin="40px"
  15.             ohos:left_margin="40px"/>
  16.     
  17.     
  18.         ohos:width="match_parent"
  19.         ohos:height="920px"
  20.         ohos:orientation="horizontal">
  21.         
  22.             ohos:id="$+id:direction1"
  23.             ohos:height="match_parent"
  24.             ohos:width="820px">
  25.             
  26.                 ohos:width="600px"
  27.                 ohos:height="600px"
  28.                 ohos:top_margin="60px"
  29.                 ohos:left_margin="100px"
  30.                 ohos:image_src="$media:index7"/>
  31.         
  32.         
  33.             ohos:height="match_parent"
  34.             ohos:width="1100px">
  35.             
  36.                 ohos:width="match_content"
  37.                 ohos:height="match_content"
  38.                 ohos:multiple_lines="true"
  39.                 ohos:text="你好,歡迎來(lái)到鴻蒙時(shí)代!
  40.                                     蛟龍騰飛,鴻蒙先行者,全心全意為你提供鴻蒙各項(xiàng)服務(wù)!  馬上咨詢:
  41.                                              李先生:13725519713 或 18138827525"
  42.                 ohos:text_size="25fp"
  43.                 ohos:top_margin="240px"
  44.                 ohos:left_margin="10px"/>
  45.         
  46.     

 然后再第一個(gè)頁(yè)面中加入點(diǎn)擊事件進(jìn)行跳轉(zhuǎn)

 
 
 
 
  1. Button button = (Button) findComponentById(ResourceTable.Id_jltfbutton);
  2.   button.setClickedListener(new Component.ClickedListener() {
  3.         @Override
  4.         public void onClick(Component component) {
  5.             present(new JltfAbilitySlice(),new Intent());
  6.         }
  7.     });

Smart vision模擬器上的代碼案例

新建項(xiàng)目選擇模板進(jìn)行下一步。

這里選擇的是js開發(fā)的模板就需要下載node.js文件在編輯器中進(jìn)行配置(node.js)網(wǎng)上有下載教程。

顯示效果:

點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面

代碼如下:

 Index.hml

 
 
 
 
  1.     
  2.        蛟龍騰飛
  3.     
  4.     
  5.         
  6.         
  7.             
  8.                 帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互
  9.             
  10.             
  11.                 聯(lián)網(wǎng)時(shí)代. 跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智
  12.             
  13.             
  14.                 能世界!。馬上創(chuàng)建體驗(yàn)個(gè)人、
  15.             
  16.             
  17.                 公司或組織的鴻蒙應(yīng)用吧!
  18.             
  19.             
  20.         
  •     
  • Index.css

     
     
     
     
    1. .container {
    2.     flex-direction: column;
    3.     width: 960px;
    4.     height: 480px;
    5.     justify-content: center;
    6.     align-items: center;
    7. }
    8. .container1 {
    9.     flex-direction: row;
    10.     width: 960px;
    11.     height: 400px;
    12. }
    13. .container2 {
    14.     margin-left: 30px;
    15.     flex-direction: column;
    16.     width: 600px;
    17.     height: 400px;
    18. }
    19. .jltftxt {
    20.      margin-left: -700px;
    21.      margin-bottom: 10px;
    22.     font-size: 45px;
    23. }
    24. .jltftxt1 {
    25.     margin-top: 45px;
    26. }
    27. .jltftxt4 {
    28.     margin-left: 5px;
    29. }
    30. .jltfimg {
    31.     margin-top: 40px;
    32.     width: 300px;
    33.     height: 282px;
    34.     margin-left: 40px;
    35. }
    36. .jltfbtn {
    37.     height: 60px;
    38.     width: 280px;
    39.     margin-left: 260px;
    40.     margin-top: 50px;
    41. }
    42. .jltftxt1,.jltftxt2,.jltftxt3,.jltftxt4{
    43.     font-size: 40px;
    44.     margin-left: 20px;
    45. }

    Index.js

     
     
     
     
    1. import router from '@system.router'
    2. export default {
    3.     data: {
    4.     },
    5.     jltfclick() {
    6.         router.replace({
    7.             uri:'pages/jltfindex/jltfindex'
    8.         });
    9.     }
    10. }
    11.  
    12. jltfIndex.hml
    13.     
    14.         蛟龍騰飛
    15.     
    16.      
    17.     
    18.          
    19.              
    20.                  你好,歡迎來(lái)到鴻蒙時(shí)代!
    21.              
    22.              
    23.                  蛟龍騰飛,鴻蒙先行者,全
    24.              
    25.              
    26.                  心全意為你提供鴻蒙各項(xiàng)服
    27.              
    28.              
    29.                  務(wù)!
    30.              
    31.          
  •      
  • jltfIndex.css

     
     
     
     
    1. .container {
    2.     flex-direction: column;
    3.     width: 960px;
    4.     height: 480px;
    5.     justify-content: center;
    6.     align-items: center;
    7. }
    8. .container1 {
    9.     flex-direction: row;
    10.     width: 960px;
    11.     height: 400px;
    12. }
    13. .container2 {
    14.     margin-left: 5px;
    15.     flex-direction: column;
    16.     width: 600px;
    17.     height: 400px;
    18. }
    19. .jltftxt {
    20.     margin-left: -700px;
    21.     margin-bottom: 10px;
    22.     font-size: 45px;
    23. }
    24. .jltftxt1 {
    25.     margin-top: 50px;
    26. }
    27. .jltfimg {
    28.     margin-top: 20px;
    29.     width: 357px;
    30.     height: 321px;
    31.     margin-left: 20px;
    32. }
    33. .jltftxt1,.jltftxt2,.jltftxt3,.jltftxt4{
    34.     font-size: 45px;
    35.     margin-left: 20px;
    36. }
    37.  

    jltfIndex.js

     
     
     
     
    1. export default {
    2.     data: {
    3.     }
    4. }

    在第一個(gè)頁(yè)面js文件中加入跳轉(zhuǎn)的代碼

     
     
     
     
    1. jltfclick() {
    2.         router.replace({
    3.             uri:'pages/jltfindex/jltfindex'
    4.         });
    5.     }

     還得在配置文件中配置相關(guān)下一個(gè)頁(yè)面的位置

    config.json找到圖中js的位置

     
     
     
     
    1. "js": [
    2.   {
    3.     "pages": [
    4.       "pages/index/index",
    5.       "pages/jltfindex/jltfindex"
    6.     ],
    7.     "name": "default"
    8.   }
    9. ]

     加入"pages/jltfindex/jltfindex"下一個(gè)頁(yè)面位置即可

    wearable模擬器上的代碼案例

    新建項(xiàng)目選擇模板進(jìn)行下一步。

    顯示效果:

    點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面

    代碼如下:

    第一個(gè)頁(yè)面

     
     
     
     
    1. Index.hml
    2.     
    3.        蛟龍騰飛
    4.     
    5.     
    6.     
    7.         帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互
    8.     
    9.     
    10.         聯(lián)網(wǎng)時(shí)代. 跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智
    11.     
    12.     
    13.          能世界!。馬上創(chuàng)建體驗(yàn)個(gè)人、
    14.     
    15.     
    16.         公司或組織的鴻蒙應(yīng)用吧!
    17.     
    18.     

     Index.css

     
     
     
     
    1. .container {
    2.     flex-direction: column;
    3.     width: 454px;
    4.     height: 454px;
    5.     justify-content: center;
    6.     align-items: center;
    7. }
    8. .jltftxt {
    9.      margin-left: -180px;
    10.      margin-bottom: 10px;
    11. }
    12. .jltftxt1 {
    13.     width: 400px;
    14.     font-size: 30px;
    15. }
    16. .jltftxt4 {
    17.     margin-left: 5px;
    18. }
    19. .jltfimg {
    20.     width: 138px;
    21.     height: 103px;
    22.     margin-left: 5px;
    23. }
    24. .jltfbtn {
    25.     height: 60px;
    26.     width: 280px;
    27.     margin-bottom: -60px;
    28. }
    29. .jltftxt1,.jltftxt2,.jltftxt3,.jltftxt4{
    30.     font-size: 30px;
    31. }

     Index.js

     
     
     
     
    1. import router from '@system.router'
    2. export default {
    3.     data: {
    4.     },
    5.     jltfclick() {
    6.         router.replace({
    7.             uri:'pages/jltfindex/jltfindex'
    8.         });
    9.     }
    10. }
    11.  

     Jltfidnex.hml

      
     
     
     
    1.     
    2.         蛟龍騰飛
    3.     
    4.     
    5.     
    6.         你好,歡迎來(lái)到鴻蒙時(shí)代!
    7.     
    8.     
    9.         蛟龍騰飛,鴻蒙先行者,全心全
    10.     
    11.     
    12.         意為你提供鴻蒙各項(xiàng)服務(wù)!
    13.     

     Jltfindex.css

     
     
     
     
    1. .container {
    2.     flex-direction: column;
    3.     width: 454px;
    4.     height: 454px;
    5.     justify-content: center;
    6.     align-items: center;
    7. }
    8. .jltftxt {
    9.     margin-left: -180px;
    10.     margin-bottom: 10px;
    11. }
    12. .jltftxt1 {
    13.     width: 400px;
    14.     font-size: 30px;
    15.     margin-left: 30px;
    16. }
    17. .jltfimg {
    18.     width: 413px;
    19.     height: 103px;
    20.     margin-left: 8px;
    21. }
    22. .jltfbtn {
    23.     width: 200px;
    24.     margin-bottom: -70px;
    25. }
    26. .jltftxt1,.jltftxt2,.jltftxt3,.jltftxt4{
    27.     font-size: 30px;
    28. }

     Jltfindex.js

     
     
     
     
    1. export default {
    2.     data: {
    3.     }
    4. }

     然后進(jìn)行頁(yè)面跳轉(zhuǎn)的配置

    在一個(gè)頁(yè)面index.js中進(jìn)行配置

     
     
     
     
    1. jltfclick() {
    2.         router.replace({
    3.             uri:'pages/jltfindex/jltfindex'
    4.         });
    5.     }

     這樣了還不能跳轉(zhuǎn),“wearable”和“l(fā)itewearable
    本文名稱:鴻蒙HarmonyOS北向應(yīng)用開發(fā)者極速入門教程(一)續(xù)-實(shí)戰(zhàn)練習(xí)篇1
    文章來(lái)源:http://www.5511xx.com/article/coceico.html