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

和華為官方合作共建的鴻蒙技術(shù)社區(qū)
https://harmonyos./#zz
Tablet 模擬器上的代碼案例
新建項(xiàng)目選擇模板進(jìn)行下一步。
顯示效果:
點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面
代碼如下
第一個(gè)頁(yè)面的布局
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:height="match_parent"
- ohos:width="match_parent"
- ohos:orientation="vertical">
- ohos:width="match_parent"
- ohos:weight="1">
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:text="蛟龍騰飛"
- ohos:text_size="40fp"
- ohos:top_margin="180px"
- ohos:left_margin="80px"/>
- ohos:width="match_parent"
- ohos:weight="4"
- ohos:orientation="horizontal">
- ohos:height="match_parent"
- ohos:weight="1">
- ohos:width="600px"
- ohos:height="600px"
- ohos:top_margin="160px"
- ohos:left_margin="100px"
- ohos:image_src="$media:index6"/>
- ohos:height="match_parent"
- ohos:weight="2">
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:multiple_lines="true"
- ohos:text="帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互聯(lián)網(wǎng)時(shí)代
- 跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智能世界!
- 馬上創(chuàng)建體驗(yàn)個(gè)人、公司或組織的鴻蒙應(yīng)用吧!"
- ohos:text_size="35fp"
- ohos:top_margin="240px"
- ohos:left_margin="60px"/>
第二個(gè)頁(yè)面的布局
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:height="match_parent"
- ohos:width="match_parent"
- ohos:orientation="vertical">
- ohos:width="match_parent"
- ohos:weight="1"
- >
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:text="蛟龍騰飛"
- ohos:text_size="40fp"
- ohos:top_margin="180px"
- ohos:left_margin="80px"/>
- ohos:width="match_parent"
- ohos:weight="4"
- ohos:orientation="horizontal">
- ohos:height="match_parent"
- ohos:weight="1">
- ohos:width="600px"
- ohos:height="600px"
- ohos:top_margin="60px"
- ohos:left_margin="100px"
- ohos:image_src="$media:index7"/>
- ohos:height="match_parent"
- ohos:weight="2">
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:multiple_lines="true"
- ohos:text="你好,歡迎來(lái)到鴻蒙時(shí)代!
- 蛟龍騰飛,鴻蒙先行者,全心全意為你提供鴻蒙各項(xiàng)服務(wù)!"
- ohos:text_size="35fp"
- ohos:top_margin="240px"
- ohos:left_margin="10px"/>
然后再第一個(gè)頁(yè)面中添加點(diǎn)擊事件進(jìn)行跳轉(zhuǎn)
- Button button = (Button) findComponentById(ResourceTable.Id_jltfbutton);
- button.setClickedListener(new Component.ClickedListener() {
- @Override
- public void onClick(Component component) {
- present(new jltftabletSlice(),new Intent());
- }
- });
Lite wearable模擬器上的代碼案例
新建項(xiàng)目選擇模板進(jìn)行下一步。
顯示效果:
點(diǎn)擊“點(diǎn)擊了解更多”進(jìn)入下一個(gè)頁(yè)面
代碼如下:
Index.hml
- 蛟龍騰飛
- 帶你從傳統(tǒng)的互聯(lián)網(wǎng)、移動(dòng)互
- 聯(lián)網(wǎng)時(shí)代. 跳轉(zhuǎn)到萬(wàn)物互聯(lián)的智
- 能世界!。馬上創(chuàng)建體驗(yàn)個(gè)人、
- 公司或組織的鴻蒙應(yīng)用吧!
Index.css
- .container {
- flex-direction: column;
- width: 454px;
- height: 454px;
- justify-content: center;
- align-items: center;
- }
- .jltftxt {
- margin-left: -180px;
- margin-bottom: 10px;
- }
- .jltftxt1 {
- width: 400px;
- font-size: 30px;
- }
- .jltfimg {
- width: 138px;
- height:103px;
- margin-left: 5px;
- }
- .jltfbtn {
- width: 200px;
- margin-bottom: -70px;
- }
Index.js
- import router from '@system.router'
- export default {
- data: {
- },
- jltfclick() {
- router.replace({
- uri:'pages/jltfindex/jltfindex'
- });
- }
- }
Jltfindex.hml
- 蛟龍騰飛
- 你好,歡迎來(lái)到鴻蒙時(shí)代!
- 蛟龍騰飛,鴻蒙先行者,全心全
- 意為你提供鴻蒙各項(xiàng)服務(wù)!
Jltfindex.css
- .container {
- flex-direction: column;
- width: 454px;
- height: 454px;
- justify-content: center;
- align-items: center;
- }
- .jltftxt {
- margin-left: -180px;
- margin-bottom: 10px;
- }
- .jltftxt1 {
- width: 400px;
- font-size: 30px;
- }
- .jltfimg {
- width: 413px;
- height:103px;
- margin-left: 8px;
- }
- .jltfbtn {
- width: 200px;
- margin-bottom: -70px;
- }
Jltfindex.js
- export default {
- data: {
- }
- }
在第一個(gè)頁(yè)面中添加跳轉(zhuǎn)的代碼
在第一個(gè)頁(yè)面js文件中加入如下代碼即可
- jltfclick() {
- router.replace({
- uri:'pages/jltfindex/jltfindex'
- });
- }
2. 練習(xí)題二
還是基于“練習(xí)一”題目中的圖片和文字內(nèi)容,7種設(shè)備中用其他不同的模板樣式嘗試實(shí)現(xiàn)一下和“練習(xí)一”模板樣式不一樣的效果,盡可能每種設(shè)備實(shí)現(xiàn)一種不同的布局和效果呈現(xiàn),作業(yè)要求,樣式截圖與全部代碼。
3. 點(diǎn)擊和嘗試DevEco Studio里的每個(gè)菜單欄,概覽這個(gè)DevEco Studio的各項(xiàng)功能結(jié)構(gòu)。結(jié)合前面的練習(xí),寫(xiě)一個(gè)100字以上的Deveco Studio體驗(yàn)心得。
具體編輯器使用的細(xì)節(jié)可以參考如下鏈接和內(nèi)容。
https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387
深圳市蛟龍騰飛網(wǎng)絡(luò)科技有限公司
?著作權(quán)歸作者和HarmonyOS技術(shù)社區(qū)共同所有,如需轉(zhuǎn)載,請(qǐng)注明出處,否則將追究法律責(zé)任
想了解更多內(nèi)容,請(qǐng)?jiān)L問(wèn):
和華為官方合作共建的鴻蒙技術(shù)社區(qū)
https://harmonyos./#zz
文章題目:鴻蒙HarmonyOS北向應(yīng)用開(kāi)發(fā)者極速入門(mén)教程(一)續(xù)-實(shí)戰(zhàn)練習(xí)篇2
地址分享:http://www.5511xx.com/article/ccojghj.html


咨詢(xún)
建站咨詢(xún)
