Android 炫酷的loading

来源:互联网 发布:linux设置待机时间 编辑:程序博客网 时间:2024/05/29 03:34

话不多说先上图效果图


代码写法就不介绍了 直接上用法 



xml布局

<com.tong_ci.dome.widget.LoadingView    android:id="@+id/loadingView"    android:layout_width="100dip"    android:layout_height="100dip" />
java代码

LoadingView loadingView = (LoadingView) findViewById(R.id.loadingView);loadingView.setCircularSize(45); //设置圆形大小loadingView.setAngleSpeed(8);//设置旋转速度(建议取值范围4-8)loadingView.setColors(new int[]{Color.BLACK,Color.BLUE,Color.GRAY}); //设置loading颜色loadingView.setLoadingWidth(3);//设置loading的宽度
用法十分简单,将LoadingView.java类放进项目目录后就可直接使用
 传送门
高仿58 loading

xml布局

<com.tong_ci.dome.widget.ShapeChangeLoadingView    android:layout_width="150dip"    android:layout_height="100dip" />
api

setShapeSize(int dipSize)   设置图形大小
setMovingSpeed(int movingSpeed)  设置移动速度
setCircularColor(int circularColor) 设置圆形图片颜色
setTriangleColor(int triangleColor) 设置三角形颜色
setSquareColor(int squareColor) 设置正方形颜色
 setShadowColor(intshadowColor) 设置阴影颜色


下载资源中的class类 阴影有适配问题 解决方法 将shadow()方法中的oval.top=VIEW_HEIGHT-15;改为oval.top=VIEW_HEIGHT-dip2px(6);


传送门


1 0