文件名称:CircularProgressButton
文件大小:2.52MB
文件格式:ZIP
更新时间:2018-06-19 17:35:47
Button
package com.example.androidtest.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.StateSet;
import android.widget.Button;
import com.example.androidtest.R;
public class CircularProgressButton extends Button {
/**
* 状态代号
* 0为初始状态,-1失败状态,100为完成状态,50为不明确中间状态
*/
public static final int IDLE_STATE_PROGRESS = 0;
public static final int ERROR_STATE_PROGRESS = -1;
public static final int SUCCESS_STATE_PROGRESS = 100;
public static final int INDETERMINATE_STATE_PROGRESS = 50;
/**
* 背景StrokeGradientDrawable
* A Drawable with a color gradient for buttons, backgrounds, etc.
* It can be defined in an XML file with the