当前位置:网站首页>Circulaindicator component, which makes the indicator style more diversified
Circulaindicator component, which makes the indicator style more diversified
2022-07-25 18:41:00 【51CTO】
CircleIndicator Components , Diversify indicator styles
UI Interface is an essential part of application visualization . Exquisitely designed UI The interface can make the whole visual application leave a deep impression on users , It is the most direct way to improve the user interface experience .
ArkUI The development framework provides developers with rich UI Native component , Such as Navigation(Page The root container of the page )、ScrollBar( Scroll bar assembly )、Swiper( Developers just need to focus on the implementation logic ) And Tabs( Container components that switch content views through tabs ) etc. . among ,Swiper Components and Tabs Components are introduced into the use of indicators in application development , But directly use native Swiper Components and Tabs Components are not suitable for complex UI Indicator interaction changes . therefore , We aim at Swiper Components and Tabs The component is simply encapsulated in the application direction of the indicator , With CiecleIndicator Third party components are provided in the form of application dependencies , So it improves ArkUI Development framework UI The ability of the indicator style of the interface to diversify .
CircleIndicator Introduce
CircleIndicator Components UI Effect display
Circular indicator :

Bar indicator :

Banner indicator :

Triangle indicator :

Icon indicator :

Carrying the central view Tabs Indicator :

Fixed position Tabs Indicator :

Fixed position Tabs Indicator ( Capsule style ):

Fixed position Tabs Indicator ( Carry a corner sign ):

Sliding Tabs Indicator :

Sliding Tabs Indicator ( Water drop slider ):

Sliding Tabs Indicator ( The first column is fixed ):

titles Indicator :

What is? CircleIndicator?
CircleIndicator seeing the name of a thing one thinks of its function , It refers to the circular indicator . But in us OpenHarmony In the tripartite component CircleIndicator The component is no longer a narrow circular indicator , It is a normalized indicator assembly that integrates indicators in various forms .
CircleIndicator Source code implementation
Here we have CircleIndicator In the component source code TriangularIndicator.ets The file expands the analysis for the sample object of source code analysis . First create TriangularIndicator.ets file , Use namespaces to create TriangularIndicator Initialize model :
take TriangularIndicator Application componentization :
The final will be TriangularIndicator Exposed for external reference :
CircleIndicator actual combat
Create project
As shown in the figure , stay DevEco Studio New China CircleIndicator_Test project , Project type selection Application, Language choice eTS, Click on Finish Finish creating .

Create a project
Add dependency
After successfully creating the project , The next step is to CircleIndicator Download components into the project . Please refer to how to install before adding dependencies OpenHarmony npm package (https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md) complete OpenHarmony npm Environment configuration . complete OpenHarmony npm After environment configuration , stay DevEco Studio Bottom navigation bar , Click on “Terminal”( Shortcut key Alt+F12), Enter command :npm install @ohos/circle-indicator --save And return , here CircleIndicator Components are automatically downloaded into the project . After downloading, the project root directory will generate node_modules/@ohos/CircleIndicator Catalog .
Write logic code
Offer a variety of Indicator, The method of use is similar to , With TriangularIndicator For example
1. initialization : Instantiation TabsController And corresponding Indicator.Model object , And add number Type member to record the current page subscript
2. Property settings : adopt Model Class object settings UI Attributes define the desired style , You can also add the required callback
3. Interface drawing : stay Tabs Next to the component Indicator Components , Note that you need to turn off native bar. And monitor Tabs Component's touch event , Notified to Model class , To deal with sliding logic in a unified way
This period is based on OpenHarmony API8 Of CircleIndicator Components 1.0.3(https://gitee.com/openharmony-sig/CircleIndicator/tree/1.0.3) Let me introduce you to this , Welcome to participate and contribute . Learn more about the dynamics of third-party components , Please pay attention to the summary of third-party component resources (https://gitee.com/openharmony-tpc/tpc_resource), More excellent components are waiting for you to find !
边栏推荐
- Qtimgui compilation
- 市值300亿,欧洲十年来最大IPO再冲纽交所
- VC/PE正跑向青岛
- Powell's function of Ceres
- Paper revision reply 1
- 对迁移学习中域适应的理解和3种技术的介绍
- Project: serial port receiving RAM storage TFT display (complete design)
- The auction house is a VC, and the first time it makes a move, it throws a Web3
- 1--- electronic physical cognition
- 浅析回归问题、建模、预测
猜你喜欢
![[Huawei machine test real question] string matching](/img/0f/972cde8c749e7b53159c9d9975c9f5.png)
[Huawei machine test real question] string matching

Interview shock: why does TCP need three handshakes?

Experimental reproduction of image classification (reasoning only) based on caffe resnet-50 network

Visual model network connection

进程间的通信(管道通信)

JVM基础和问题分析入门笔记

【网页性能优化】SPA(单页面应用)首屏加载速度慢怎么办?

从目标检测到图像分割简要发展史

MySQL index optimization introduction

7. 依赖注入
随机推荐
R language uses GT package and gtextras package to display tabular data beautifully: GT_ bar_ Plot function and GT_ plt_ bar_ PCT function visual percentage bar graph, percentage bar graph of original
如何创建一个有效的帮助文档?
[QNX hypervisor 2.2 user manual]9.5 dump
Introduction notes of JVM foundation and problem analysis
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
黄鹤楼超震撼视角,这样的VR全景你绝对没见过!
字符串函数和内存函数(二)
Visual model network connection
Dynamic memory management
The auction house is a VC, and the first time it makes a move, it throws a Web3
Northeast people know sexiness best
Tensor to img && imge to tensor (pytorch的tensor转换)
Nc15 sequence traversal of binary tree
How to build an enterprise level OLAP data engine for massive data and high real-time requirements?
GAN的详细介绍及其应用(全面且完整)
遍历数组的方法有哪些?for循环 forEach for/in for/of map的性能又有什么差别 该如何选择?
推特收购舆论战,被马斯克变成了小孩吵架
8 年产品经验,我总结了这些持续高效研发实践经验 · 研发篇
MySQL index optimization introduction
Common file operations