1 Star 3 Fork 3

CHINASOFT_OHOS/ViewPagerIndicator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

ViewPagerIndicator

项目介绍

  • 项目名称:ViewPagerIndicator工具类
  • 所属系列:openharmony的第三方组件适配移植
  • 功能:一个简单好用的ViewPagerIndicator,提供了五种类型,采用在XML布局中定制颜色大小等参数,在JAVA代码中只需二行代码就能为viewpager添加酷炫效果,并且支持轮播图
  • 项目移植状态:移植完成,遗留指示器动画偶发异常,后续维护
  • 调用差异:无
  • 开发版本:sdk6,DevEco Studio2.2 Beta1
  • 基线版本:Release 0.3.0

效果演示

0

安装教程

1.在项目根目录下的build.gradle文件中,

allprojects {
   repositories {
       maven {
           url 'https://s01.oss.sonatype.org/content/repositories/releases/'
       }
   }
}

2.在entry模块的build.gradle文件中,

dependencies {
      implementation('com.gitee.chinasoft_ohos:ViewPagerIndicator:1.0.0')
      implementation('com.gitee.chinasoft_ohos:ViewPagerIndicator-LibBanner:1.0.0')
}

在sdk6,DevEco Studio2.2 Beta1下项目可直接运行。如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下

使用说明

1.将ViewPagerIndicator 添加到xml

<com.lwj.widget.viewpagerindicator.ViewPagerIndicator
                ohos:id="$+id:default_indicator"
                ohos:height="40vp"
                ohos:width="match_parent"
                ohos:background_element="$color:gray_40"
                ohos:layout_alignment="center"
                app:vpi_default_color="#cdcdcd"
                app:vpi_distance="100"
                app:vpi_distanceType="1"
                app:vpi_indicatorType="1"
                app:vpi_radius="30"
                app:vpi_selected_color="#ffffff"
                />

Properties:

  • app:vpi_selected_color
  • app:vpi_default_color (如果 indicatorType=CIRCLE_LINE default_color 为指示器唯一颜色 ,selected_color 不起作用)
  • app:vpi_radius (点的大小,在indicatorType= CIRCLE_LINE 的情况下 radius 是点的高)
  • app:vpi_radius_selected (只作用在indicatorType= CIRCLE 的情况下,为选中点的大小,默认为radius大小)
  • app:vpi_length (只作用在 indicatorType=CIRCLE_LINE 的情况下,为 指示器点的长度)
  • app:vpi_distance (只作用在 distanceType=BY_DISTANCE 的情况下)
  • app:vpi_num
  • app:vpi_indicatorType (LINE; CIRCLE; CIRCLE_LINE; BEZIER;SPRING)

LINE:线 ; CIRCLE:圆点(默认) ; CIRCLE_LINE:圆角矩形; BEZIER:弹性球 ; SPRING: 弹簧粘性球; PROGRESS: 进度条

  • app:vpi_distanceType (BY_RADIUS; BY_DISTANCE ; BY_LAYOUT )
    • BY_DISTANCE =1
    • BY_RADIUS=0;
    • BY_LAYOUT =2;

BY_RADIUS:3倍radius ; BY_DISTANCE :定义固定距离 ;BY_LAYOUT :根据layout_width均分得到距离

  • app:vpi_animation(默认为true:动画开启 ; false:关闭动画)

2.在CarouseAbilitySlice中添加代码:

mPageSlider.setCircularModeEnabled(true); // 设置无限循环
mPageSlider.setProvider(mFractionAdapterFraction);
mPageSlider.setCurrentPage(firstIndex);
ViewPagerIndicator mIndicatorDefault = (ViewPagerIndicator) findComponentById(ResourceTable.Id_default_indicator);
mIndicatorDefault.setViewPager(mPageSlider, num);

测试信息

CodeCheck代码测试无异常

CloudTest代码测试无异常

病毒安全检测通过

当前版本demo功能与原组件基本无差异

版本迭代

  • 1.0.0

版权和许可信息

Copyright 2017 LinWeiJia

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

空文件

简介

一个简单好用的ViewPagerIndicator,提供了五种类型,采用在XML布局中定制颜色大小等参数,在JAVA代码中只需二行代码就能为viewpager添加酷炫效果,并且支持轮播图 展开 收起
README
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

语言

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/chinasoft_ohos/ViewPagerIndicator.git
git@gitee.com:chinasoft_ohos/ViewPagerIndicator.git
chinasoft_ohos
ViewPagerIndicator
ViewPagerIndicator
master

搜索帮助