3 Star 5 Fork 1

CHINASOFT_OHOS / AndRatingBar

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

AndRatingBar

项目介绍

  • 项目名称:AndRatingBar
  • 所属系列:openHarmony的第三方组件适配移植
  • 功能:继承自原生Rating,具有原生的滑动选择等特性,并且可以自定义大小,间距,颜色,图标,支持从右当左
  • 项目移植状态:90%,星星间距调整目前暂未支持。
  • 调用差异:无
  • 开发版本:sdk6,DevEco Studio 2.2 Beta1
  • 基线版本:Releases 1.0.6

效果演示

输入图片说明 输入图片说明 输入图片说明 输入图片说明

安装教程

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:AndRatingBar:1.0.0')
   ......  
}

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

使用说明

在 layout 文件中:

<per.wsj.library.AndRatingBar
    ohos:height="48vp"
    ohos:width="match_content"
    ohos:score="2.5"
    app:starStep="0.5"
    app:starDrawable="$graphic:ic_rating_star"
    app:bgDrawable="$graphic:ic_rating_star_bg"
    app:halfStarDrawable="$graphic:ic_rating_star_half"/>

事件监听

ratingBar.setRatingChangedListener(new Rating.RatingChangedListener() {
    @Override
    public void onProgressChanged(Rating rating, int i, boolean b) {
        HiLog.error(TAG,"rating:"+rating.getScore());
    }

    @Override
    public void onStartTrackingTouch(Rating rating) {

    }

    @Override
    public void onStopTrackingTouch(Rating rating) {

    }
});

配置

AndRatingBar继承自openHarmony Rating,因此Rating的所有配置都可以配置为AndRatingBar, AndRatingBar具有自己的配置,如下所示:

  • app:starDrawable="" 设置选中星星背景图标
  • app:bgDrawable="" 设置未选中星星背景图标
  • app:halfStarDrawable="" 步数为0.5时,设置半选状态星星背景图标
  • app:right2LeftHalfDrawable="" 步数为0.5并且right2Left为true时,设置半选状态星星背景图标
  • app:starStep="" 设置星星步数
  • app:starColor="" 当星星步数为整数时,设置星星选中状态颜色
  • app:bgColor="" 当星星步数为整数时,设置星星未选中状态颜色
  • app:right2Left="true" 是否支持从右往左

测试信息

CodeCheck代码测试无异常

CloudTest代码测试无异常

病毒安全检测通过

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

版本迭代

  • 1.0.0

版权和许可信息

  • AndRatingBar is released under the Apache License version 2.0.

About

RatingBar终极方案,继承自原生Rating,具有原生的滑动选择等特性,并且可以自定义大小,间距,颜色,图标,支持从右当左 expand collapse
Java and 2 more languages
Apache-2.0
Cancel

Releases

No release

AndRatingBar

Contributors

All

Activities

Load More
can not load any more
Java
1
https://gitee.com/chinasoft_ohos/AndRatingBar.git
git@gitee.com:chinasoft_ohos/AndRatingBar.git
chinasoft_ohos
AndRatingBar
AndRatingBar
master

Search