RectCircleProgressButton 动画效果的按钮

来源:互联网 发布:nosql数据库的优点 编辑:程序博客网 时间:2024/05/01 07:25

RectCircleProgressButton

项目地址:ClownQiang/RectCircleProgressButton
简介:带着动画效果的按钮

前段时间工作需要用到一个按钮的效果,但是简单做了一下,最近闲下来一点整理了一下,代码略乱,欢迎各种类型 issue,后续看看再整理吧。

怎么使用

dependencies {    compile 'com.clownqiang:RectCircleProgressButton:1.0.1'}
<com.clownqiang.rectcircleprogressbutton.RectCircleProgressButton        android:id="@+id/btn_rect_circle"        android:layout_width="match_parent"        android:layout_height="45dp"        app:rcpb_circle_color="@android:color/holo_green_dark"        app:rcpb_rec_color="@android:color/holo_red_dark"        app:rcpb_rec_stoke_width="1dp"        app:rcpb_rec_text="Do Something"        app:rcpb_rec_text_color="@android:color/holo_red_dark"        app:rcpb_rec_text_size="16sp"        app:rcpb_rec_to_circle_color="@android:color/holo_blue_bright"        app:rcpb_rec_to_circle_interval="700"        app:rcpb_rotate_speed="30"        />

配置

rcpb_rec_text 按钮显示文字,默认显示 Downloadrcpb_rec_text_color 文字颜色rcpb_rec_text_size 文字大小rcpb_rec_color 矩形状态颜色rcpb_rec_to_circle_color 矩形变换到圆形动画时颜色rcpb_circle_color 圆形状态颜色rcpb_rec_stoke_width 线条宽度rcpb_rec_to_circle_interval 矩形变换圆形动画时间(ms)rcpb_rotate_speed 圆形旋转动画时间(ms)

可以实现接口 AnimationStatusListener:

void startLoading(int status); //变为圆形旋转状态,开始加载void resetView(int status); //reset 到矩形状态,停止加载

同时方法 resetButtonView()用于需要代码主动回退状态。

0 0
原创粉丝点击