Skip to content

jenly1314/RadarView

Repository files navigation

RadarView

Download Jitpack API License

RadarView for Android 是一个雷达扫描动画后,然后展示得分效果的控件。

Gif 展示

Image

你也可以直接下载 演示App 体验效果

引入

Gradle:

  1. 在Project的 build.gradlesetting.gradle 中添加远程仓库

    repositories {
        //...
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
  2. 在Module的 build.gradle 里面添加引入依赖项

    implementation 'com.github.jenly1314:RadarView:1.0.2'

使用

布局示例

    <com.king.view.radarview.RadarView
        android:id="@+id/rv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="100"
        app:labelText="Score" />

自定义属性

    <declare-styleable name="RadarView">
        <attr name="android:textSize"/>
        <attr name="android:textColor"/>
        <attr name="android:text"/>
        <attr name="labelTextSize" format="dimension"/>
        <attr name="labelTextColor" format="color"/>
        <attr name="labelText" format="string"/>
        <attr name="format" format="string"/>
        <attr name="sideColor" format="color"/>
        <attr name="outsideBackgroundColor" format="color"/>
        <attr name="insideBackgroundColor" format="color"/>
        <attr name="duration" format="integer"/>
        <attr name="textOffsetY" format="dimension"/>
        <attr name="labelTextOffsetY" format="dimension"/>

        <attr name="circleColor" format="color"/>
        <attr name="lineColor" format="color"/>
        <attr name="showLine" format="boolean"/>
        <attr name="rotate" format="integer"/>
        <attr name="showLabel" format="boolean"/>
        <attr name="showText" format="boolean"/>
        <attr name="scanTime" format="integer"/>
        <attr name="insideStrokeWidth" format="dimension"/>
        <attr name="outsideStrokeWidth" format="dimension"/>
        <attr name="lineStrokeWidth" format="dimension"/>
    </declare-styleable>

代码示例(核心调用代码)

//开始雷达扫描
radarView.start();
//停止雷达扫描
radarView.stop();
//设置雷达扫描区域的颜色,传多个色值表示渐变
radarView.setScanColor(int... colors);
/**
 * 显示分数
 * @param from  初始值
 * @param to    目标值(最终分数)
 * @param duration  从初始值到目标值的动画持续时间
 * @param format
 * @param isShowAnim 是否显示动画
 */
radarView.showScore(float from, float to, int duration, final String format,boolean isShowAnim);

更多使用详情,请查看app中的源码使用示例或直接查看API帮助文档

赞赏

如果您喜欢RadarView,或感觉RadarView帮助到了您,可以点右上角“Star”支持一下,您的支持就是我的动力,谢谢 😃

您也可以扫描下面的二维码,请作者喝杯咖啡 ☕

关于我

我的博客 GitHub Gitee CSDN 博客园
Jenly's Blog jenly1314 jenly1314 jenly121 jenly

联系我

微信公众号 Gmail邮箱 QQ邮箱 QQ群 QQ群
Jenly666 jenly1314 jenly1314 20867961 64020761

About

🍳 RadarView for Android 是一个雷达扫描动画后,然后展示得分效果的控件。

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages