Android环形进度条

本文介绍了如何在Android中创建自定义的环形进度条,通过在res/values/attr.xml文件中声明style属性来实现这一效果。
摘要由CSDN通过智能技术生成

圆环进度条style属性设置,在res/values/attr.xml中进行声明

<declare-styleable name="CircularProgressView">
    <attr name="backWidth" format="dimension" />    <!--背景圆环宽度-->
    <attr name="progWidth" format="dimension" />    <!--进度圆环宽度-->
    <attr name="backColor" format="color" />        <!--背景圆环颜色-->
    <attr name="progColor" format="color" />        <!--进度圆环颜色-->
    <attr name="progStartColor" format="color" />   <!--进度圆环开始颜色-->
    <attr name="progFirstColor" format="color" />   <!--进度圆环结束颜色-->
    <attr name="progress" format="integer" />       <!--圆环进度-->
</declare-styleable>

实现环形进度条效果

import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.*
import android.support.annotation.ColorRes
import android.support.annotation.Nullable
import android.support.v4.content.ContextCompat
import android.util.AttributeSet
import android.view.View
import android.view.animation.OvershootInterpolator

class CircularProgressView @JvmOverloads constructor(context: Context, @Nullable attrs: AttributeSet? = null, defStyleAttr: Int = 0) : View(context, attrs, defStyleAttr)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值