Git Product home page Git Product logo

ring's Introduction

Ring圆环进度

github

属性 类型 说明
neiYuanColor color 内圆颜色,默认透明
ringRadius dimension 圆环半径
ringWidth dimension 圆环宽度
ringColor color 圆环颜色
ringProgressColor color 圆环进度颜色
startAngle integer 开始角度,默认为-90(12点钟方向),0度是3点钟方向,90度是6点钟方向
isClockwise boolean 是否顺时针,默认true
progress float 当前进度
maxProgress float 总进度,默认100
disableAngle integer 不绘制的角度(圆环缺损角度)
isRound boolean 圆环进度是否为圆角,默认true
useAnimation boolean 是否设置动画,默认true(setProgress方法执行动画时获取progress建议设置监听事件获取)
duration integer 动画执行时间,单位:毫秒,默认1000毫秒
isDecimal boolean 进度百分比数值是否有小数点,默认true
decimalPointLength integer 小数点后几位
isShowPercentText boolean 是否显示百分比,默认true
textColor color 文字颜色
textSize dimension 文字大小,默认17sp

进度监听

CircleProgress circleprogress = (CircleProgress) findViewById(R.id.circleprogress);
circleProgress.setOnCircleProgressInter(new CircleProgress.OnCircleProgressInter() {
    @Override
    public void progress(float scaleProgress, float progress, float max) {
        //总进度max,当前进度:progress,动画执行进度:scaleProgress
    }
});
<com.github.ring.CircleProgress
    android:id="@+id/circleprogress"
    android:layout_width="200dp"
    android:layout_height="200dp"
    app:textSize="22sp"
    app:decimalPointLength="1"
    app:isShowPercentText="true"
    app:progress="120"
    app:maxProgress="200"
    app:ringProgressColor="@color/blue_00"
    app:disableAngle="0"
    app:duration="1000"
    app:isClockwise="true"
    app:isDecimal="true"
    app:isRound="true"
    app:useAnimation="true"
    app:ringColor="@color/top_color1"
    app:neiYuanColor="@color/transparent"
    app:ringRadius="90dp"
    app:ringWidth="10dp"
    app:textColor="@color/blue_00"
    />

设置过度颜色

circleprogress.post(new Runnable() {
    @Override
    public void run() {
        LinearGradient linearGradient = new LinearGradient(0,0,
                circleprogress.getWidth(),circleprogress.getHeight(),
                circleprogress.getRingProgressColor(), ContextCompat.getColor(MainActivity.this,R.color.green),
                Shader.TileMode.MIRROR);
        circleprogress.setProgressShader(linearGradient);
    }
});

如果本库对您有帮助,还希望支付宝扫一扫下面二维码,你我同时免费获取奖励金(非常感谢 Y(^-^)Y)

github

Download <--版本号

compile 'com.github:CircleProgress:版本号看上面'

ring's People

Contributors

zhongruiandroid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.