模拟了 iOS 下载 App 时候的动画:CircleLoadingView

jopen 8年前

模拟了 iOS 下载 App 时候的动画。

使用说明:

配置方法

Android Studio    allprojects {        repositories {            jcenter()            maven { url "https://jitpack.io" }        }    }      dependencies {        compile 'com.github.jhw-dev:CircleLoadingView:v1.3'    }

Eclipse

我觉得这个时候还在用 Eclipse 做 Android 开发的,要么是大神,要么就该换公司了,不如给我发个简历?

使用方法

XML 定义

<?xml version="1.0" encoding="utf-8"?>  <RelativeLayout      xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:app="http://schemas.android.com/apk/res-auto"      android:layout_width="match_parent"      android:layout_height="match_parent">        <com.tengchong.android.CircleLoadingView          android:id="@+id/loading"          android:layout_width="100dp"          android:layout_height="100dp"          app:cl_circleRadius="40dp"          app:cl_circleStrokeSize="5dp"          app:cl_fillAnimationDuration="200"          app:cl_src="@drawable/avatar"/>    </RelativeLayout>

用代码动态使用以及设定进度方式

        CircleLoadingView loadingView =new CircleLoadingView();          loadingView.setImageBitmap(                  BitmapFactory.decodeResource(getResources(), R.drawable.avatar));          loadingView.setPercent(88);

自定义属性

目前版本比较简单,仅支持在 XML 文件中自定义,另外,Drawable 只支持 BitmapDrawable,相信你懂的。

  • cl_circleRadius [dimension] --> 中间那个圆的半径

  • cl_circleStrokeSize [dimension] --> 圆的边框大小 

  • cl_fillAnimationDuration [integer] --> 最后扩散动画的时间 

  • cl_src [dimension] --> 背景的 BitmapDrawable 资源


项目地址: https://github.com/jhw-dev/CircleLoadingView