2020年9月10日,华为鸿蒙系统升级至华为鸿蒙系统2.0版本.java
首先进入首页windows
https://developer.harmonyos.com/浏览器
发现跳转到这个页面,页面提示咱们去参考,DevEco Studio快速开始页面去完成搭建.cookie
当前只支持windows系统,ide
下载地址 : https://developer.harmonyos.com/cn/develop/deveco-studio网站
下载过程当中须要一个华为帐号,正常登上就好了.this
安装完成后打开,果不其然看到了Intellij IDAE的影子.spa
只不过须要自动安装JDK3d
进入开始页,天然要建立一个新的工程.调试
选择一个可穿戴设备的项目,
输入信息
建立以后开始自动配置,配置期间弹出一些似曾相识的东西也没必要奇怪。
点击运行按钮
运行试试
发现尚未设备 ,因而去Tools下面找到HVD Manager
自动下载以后,点击模拟器界面左下角的Refresh按钮,弹出一个页面,进入开发者实名认证.
很快,用银行卡一会儿就认证成功了
虽然我在网站上的登录是成功的,可是个人本地IDE始终没法登陆,我从新Refresh以后页仍是不行,
发现文档中字样:要取消阻止跨站跟踪和阻止全部Cookie功能。
首先关闭全部网页,而后再设置中,关掉cookie.但这种方式根本不行!!!!
后面,我关掉全部的浏览器,逐一尝试以后,回到了不阻止coooki,胡乱尝试,居然就成功了。。。。。。。。。。。。。。
至于我如何成功的,我也不知道了。。。。。。。。。。。总之跳到这里。
回到IDE中,设备也有了。
点击小蓝按钮,启动设备,这里选择的是启动穿戴设备。
这个手表看起来还能够。。。。
这时候再启动调试程序。
哦哈哈哈,发现有设备了。
既然环境没问题了,那就改改代码吧.
在这个目录下面,
修改代码
package com.yuchengtest.slice; import ohos.aafwk.ability.AbilitySlice; import ohos.aafwk.content.Intent; import ohos.agp.components.DirectionalLayout; import ohos.agp.components.DirectionalLayout.LayoutConfig; import ohos.agp.components.Text; import ohos.agp.colors.RgbColor; import ohos.agp.components.element.ShapeElement; import ohos.agp.utils.Color; import ohos.agp.utils.TextAlignment; public class MainAbilitySlice extends AbilitySlice { private DirectionalLayout myLayout = new DirectionalLayout(this); @Override public void onStart(Intent intent) { super.onStart(intent); LayoutConfig config = new LayoutConfig(LayoutConfig.MATCH_PARENT, LayoutConfig.MATCH_PARENT); myLayout.setLayoutConfig(config); ShapeElement element = new ShapeElement(); element.setRgbColor(new RgbColor(100, 255, 255)); myLayout.setBackground(element); Text text = new Text(this); text.setLayoutConfig(config); text.setText("kangyucheng"); text.setTextColor(new Color(0xFF001028)); text.setTextSize(60); text.setTextAlignment(TextAlignment.CENTER); myLayout.addComponent(text); super.setUIContent(myLayout); } @Override public void onActive() { super.onActive(); } @Override public void onForeground(Intent intent) { super.onForeground(intent); } }
结果。