赞
踩
本项目是基于开源项目[Carbon] 进行harmonyos化的移植和开发的。
移植版本:Branches/master
这不是单纯只是API和基本功能展示demo,它是最有用的自定义控件的实现,如设计规范中所示。
Carbon试图:
可以先下载项目,将项目中的carbon库提取出来放在所需项目中通过build配置
dependencies {
implementation project(":carbon")
}
buildscript {
repositories {
...
mavenCentral()
}
...
}
allprojects {
repositories {
...
mavenCentral()
}
}
dependencies {
implementation 'com.gitee.ts_ohos:carbon:1.0.0'
}
需要网络权限:
“name”: “ohos.permission.INTERNET”
打开不同的设置页面: often_text.setClickedListener(component -> { Intent intent = new Intent(); if (often_text.getText().equals("Widget animations")) { present(new WidgetAnimationsSlice(), intent); } else if (often_text.getText().equals("Image fade")) { present(new ImageFadeSlice(), intent); } else if (often_text.getText().equals("Touch ripple")) { present(new TouchRippleSlice(), intent); } else if (often_text.getText().equals("Path animation")) { present(new PathAnimationSlice(), intent); } ... // BORDERLESS 触摸事件监听器(按下/抬起)(three) btnBorderless.setTouchEventListener(new Component.TouchEventListener() { @Override public boolean onTouchEvent(Component component, TouchEvent touchEvent) { int action = touchEvent.getAction(); switch (action) { case TouchEvent.PRIMARY_POINT_DOWN: imageView.setVisibility(Component.VISIBLE); break; case TouchEvent.CANCEL: case TouchEvent.PRIMARY_POINT_UP: imageView.setVisibility(Component.HIDE); break; } return true; } }); //对每个条目判断是否收藏: mList.add(new DataBean(null, "The most popular problem solutions and other fun ideas implemented with Carbon's widgets and features", null, null)); mList.add(new DataBean(power, "Power Menu", null, preferences.getBoolean("Power Menu", false) ? starFavour : favour)); mList.add(new DataBean(null, "Auto Complete", element, preferences.getBoolean("Auto Complete", false) ? starFavour : favour)); mList.add(new DataBean(null, "Quick Return", null, preferences.getBoolean("Quick Return", false) ? starFavour : favour)); mList.add(new DataBean(search, "Search Toolbar", null, preferences.getBoolean("Search Toolbar", false) ? starFavour : favour)); mList.add(new DataBean(parse1, "Share toolbar", element, preferences.getBoolean("Share toolbar", false) ? starFavour : favour)); mList.add(new DataBean(person, "Profile", null, preferences.getBoolean("Profile", false) ? starFavour : favour)); mList.add(new DataBean(player, "Music player", element, preferences.getBoolean("Music player", false) ? starFavour : favour)); mList.add(new DataBean(null, "Collapsing toolbar", null, preferences.getBoolean("Collapsing toolbar", false) ? starFavour : favour));
gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
前往参考学习。demo部分组件运行效果如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。