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

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

新聞中心

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

 想了解更多內(nèi)容,請訪問:

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

https://harmonyos./#zz

Tablet 模擬器上的代碼案例

新建項目選擇模板進行下一步。

顯示效果:

點擊“點擊了解更多”進入下一個頁面

代碼如下

第一個頁面的布局

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

 第二個頁面的布局

 
 
 
 
  1.  
  2.     xmlns:ohos="http://schemas.huawei.com/res/ohos" 
  3.     ohos:height="match_parent" 
  4.     ohos:width="match_parent" 
  5.     ohos:orientation="vertical"> 
  6.  
  7.     
  8.         ohos:width="match_parent" 
  9.        ohos:weight="1" 
  10.         > 
  11.         
  12.             ohos:width="match_content" 
  13.             ohos:height="match_content" 
  14.             ohos:text="蛟龍騰飛" 
  15.             ohos:text_size="40fp" 
  16.             ohos:top_margin="180px" 
  17.             ohos:left_margin="80px"/> 
  18.  
  19.      
  20.     
  21.         ohos:width="match_parent" 
  22.         ohos:weight="4" 
  23.         ohos:orientation="horizontal"> 
  24.         
  25.             ohos:height="match_parent" 
  26.             ohos:weight="1"> 
  27.             
  28.                 ohos:width="600px" 
  29.                 ohos:height="600px" 
  30.                 ohos:top_margin="60px" 
  31.                 ohos:left_margin="100px" 
  32.                 ohos:image_src="$media:index7"/> 
  33.          
  34.         
  35.             ohos:height="match_parent" 
  36.             ohos:weight="2"> 
  37.             
  38.                 ohos:width="match_content" 
  39.                 ohos:height="match_content" 
  40.                 ohos:multiple_lines="true" 
  41.                 ohos:text="你好,歡迎來到鴻蒙時代! 
  42.                                     蛟龍騰飛,鴻蒙先行者,全心全意為你提供鴻蒙各項服務!" 
  43.                 ohos:text_size="35fp" 
  44.                 ohos:top_margin="240px" 
  45.                 ohos:left_margin="10px"/> 
  46.          
  47.  
  48.      
  49.  
  50.  

 然后再第一個頁面中添加點擊事件進行跳轉(zhuǎn)

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

 Lite wearable模擬器上的代碼案例

新建項目選擇模板進行下一步。

顯示效果:

點擊“點擊了解更多”進入下一個頁面

代碼如下:

Index.hml

 
 
 
 
  1.  
  2.      
  3.        蛟龍騰飛 
  4.      
  5.      
  6.      
  7.         帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動互 
  8.      
  9.      
  10.         聯(lián)網(wǎng)時代. 跳轉(zhuǎn)到萬物互聯(lián)的智 
  11.      
  12.      
  13.          能世界!。馬上創(chuàng)建體驗個人、 
  14.      
  15.      
  16.         公司或組織的鴻蒙應用吧! 
  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. .jltftxt { 
  8.      margin-left: -180px; 
  9.      margin-bottom: 10px; 
  10. .jltftxt1 { 
  11.     width: 400px; 
  12.     font-size: 30px; 
  13.  
  14. .jltfimg { 
  15.     width: 138px; 
  16.     height:103px; 
  17.     margin-left: 5px; 
  18. .jltfbtn { 
  19.     width: 200px; 
  20.     margin-bottom: -70px; 

 Index.js

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

 Jltfindex.hml

  
 
 
 
  1.  
  2.      
  3.         蛟龍騰飛 
  4.      
  5.      
  6.      
  7.         你好,歡迎來到鴻蒙時代! 
  8.      
  9.      
  10.         蛟龍騰飛,鴻蒙先行者,全心全 
  11.      
  12.      
  13.         意為你提供鴻蒙各項服務!        
  14.  
 

 Jltfindex.css

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

 Jltfindex.js

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

 在第一個頁面中添加跳轉(zhuǎn)的代碼

在第一個頁面js文件中加入如下代碼即可

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

 2. 練習題二

還是基于“練習一”題目中的圖片和文字內(nèi)容,7種設備中用其他不同的模板樣式嘗試實現(xiàn)一下和“練習一”模板樣式不一樣的效果,盡可能每種設備實現(xiàn)一種不同的布局和效果呈現(xiàn),作業(yè)要求,樣式截圖與全部代碼。

3. 點擊和嘗試DevEco Studio里的每個菜單欄,概覽這個DevEco Studio的各項功能結(jié)構(gòu)。結(jié)合前面的練習,寫一個100字以上的Deveco Studio體驗心得。

具體編輯器使用的細節(jié)可以參考如下鏈接和內(nèi)容。

https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387

深圳市蛟龍騰飛網(wǎng)絡科技有限公司

?著作權(quán)歸作者和HarmonyOS技術(shù)社區(qū)共同所有,如需轉(zhuǎn)載,請注明出處,否則將追究法律責任

想了解更多內(nèi)容,請訪問:

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

https://harmonyos./#zz


網(wǎng)站題目:鴻蒙HarmonyOS北向應用開發(fā)者極速入門教程(一)續(xù)-實戰(zhàn)練習篇2
轉(zhuǎn)載注明:http://m.5511xx.com/article/ccojghj.html