https://harmonyos.51cto.com/#zz
Tablet 模拟器上的代码案例
新建项目选择模板进行下一步。
显示效果:
点击“点击了解更多”进入下一个页面
代码如下
第一个页面的布局
- <?xml version="1.0" encoding="utf-8"?>
- <DirectionalLayout
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:height="match_parent"
- ohos:width="match_parent"
- ohos:orientation="vertical">
- <DirectionalLayout
- ohos:width="match_parent"
- ohos:weight="1">
- <Text
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:text="蛟龙腾飞"
- ohos:text_size="40fp"
- ohos:top_margin="180px"
- ohos:left_margin="80px"/>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:width="match_parent"
- ohos:weight="4"
- ohos:orientation="horizontal">
- <DirectionalLayout
- ohos:height="match_parent"
- ohos:weight="1">
- <Image
- ohos:width="600px"
- ohos:height="600px"
- ohos:top_margin="160px"
- ohos:left_margin="100px"
- ohos:image_src="$media:index6"/>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:height="match_parent"
- ohos:weight="2">
- <Text
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:multiple_lines="true"
- ohos:text="带你从传统的互联网、移动互联网时代
- 跳转到万物互联的智能世界!
- 马上创建体验个人、公司或组织的鸿蒙应用吧!"
- ohos:text_size="35fp"
- ohos:top_margin="240px"
- ohos:left_margin="60px"/>
- <Button
- ohos:id="$+id:jltfbutton"
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:text="点击了解更多"
- ohos:text_size="40fp"
- ohos:top_margin="380px"
- ohos:left_margin="1000px"
- ohos:text_color="red"/>
- </DirectionalLayout>
- </DirectionalLayout>
- </DirectionalLayout>
第二个页面的布局
- <?xml version="1.0" encoding="utf-8"?>
- <DirectionalLayout
- xmlns:ohos="http://schemas.huawei.com/res/ohos"
- ohos:height="match_parent"
- ohos:width="match_parent"
- ohos:orientation="vertical">
- <DirectionalLayout
- ohos:width="match_parent"
- ohos:weight="1"
- >
- <Text
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:text="蛟龙腾飞"
- ohos:text_size="40fp"
- ohos:top_margin="180px"
- ohos:left_margin="80px"/>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:width="match_parent"
- ohos:weight="4"
- ohos:orientation="horizontal">
- <DirectionalLayout
- ohos:height="match_parent"
- ohos:weight="1">
- <Image
- ohos:width="600px"
- ohos:height="600px"
- ohos:top_margin="60px"
- ohos:left_margin="100px"
- ohos:image_src="$media:index7"/>
- </DirectionalLayout>
- <DirectionalLayout
- ohos:height="match_parent"
- ohos:weight="2">
- <Text
- ohos:width="match_content"
- ohos:height="match_content"
- ohos:multiple_lines="true"
- ohos:text="你好,欢迎来到鸿蒙时代!
- 蛟龙腾飞,鸿蒙先行者,全心全意为你提供鸿蒙各项服务!"
- ohos:text_size="35fp"
- ohos:top_margin="240px"
- ohos:left_margin="10px"/>
- </DirectionalLayout>
- </DirectionalLayout>
- </DirectionalLayout>
然后再第一个页面中添加点击事件进行跳转
- 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模拟器上的代码案例
新建项目选择模板进行下一步。
显示效果:
点击“点击了解更多”进入下一个页面
代码如下:
Index.hml
- <div class="container">
- <text class="jltftxt">
- 蛟龙腾飞
- </text>
- <image src="/common/index22.jpg" class="jltfimg"/>
- <text class="jltftxt1">
- 带你从传统的互联网、移动互
- </text>
- <text class="jltftxt2">
- 联网时代. 跳转到万物互联的智
- </text>
- <text class="jltftxt3">
- 能世界!。马上创建体验个人、
- </text>
- <text class="jltftxt4">
- 公司或组织的鸿蒙应用吧!
- </text>
- <input class="jltfbtn"type="button" value="点击了解更多" onclick="jltfclick"/>
- </div>
Index.css
[中国,上海,2021年2月25日]在MWC 2021上海智能自治网络峰会上,华为数字转型首...
操作场景 云服务器的系统盘在创建云服务器时自动创建并挂载,无需单独购买。 数...
4月27日,甘肃省陇南市中西医结合医院开工仪式在陇南市武都区举行,陇南市相关领...
日前,普华永道中国携手华为云在第三届中国国际进口博览会上发布了汽车和金融行业...
从诞生到开放使用 随着中国的发展,很多技术因为一些原因越来越受制于人,尤其是...
在操作系统中查看硬盘容量时,获得的容量可能会比BMS服务官网标称的容量小,造成...
高可用架构设计之无状态服务 笑谈架构设计 事故的发生是量的积累的结果,任何事...
科技时代的进步和发展,生活的方方面面都在被改变。人脸识别被应用到各个领域中...
一、前言 今天小编带大家制作一个经典的网站的案例,功能包括登录、注册、注销、...
本文转载自微信公众号「老王Plus」,作者老王Plus的老王 。转载本文请联系老王Pl...