没有合适的资源?快使用搜索试试~ 我知道了~
最近,看了好多的APP的等待对话框,发现自己的太lower,于是就研究了一番,最后经过苦心努力,实现一个。 自定义一个LoadingIndicatorView(extends View )类 编写values/attrs.xml,在其中编写styleable和item等标签元素 在布局文件中LoadingIndicatorView使用自定义的属性(注意namespace) 在LoadingIndicatorView的构造方法中通过TypedArray获取 描述就提供这些,一下是代码的展示,非常的详细。 1、自定义属性的声明文件 <declare-styleable n
资源推荐
资源详情
资源评论
Android自定义等待对话框自定义等待对话框
最近,看了好多的APP的等待对话框,发现自己的太lower,于是就研究了一番,最后经过苦心努力,实现一个。
自定义一个自定义一个LoadingIndicatorView(extends View )类类
编写编写values/attrs.xml,在其中编写,在其中编写styleable和和item等标签元素等标签元素
在布局文件中在布局文件中LoadingIndicatorView使用自定义的属性(注意使用自定义的属性(注意namespace))
在在LoadingIndicatorView的构造方法中通过的构造方法中通过TypedArray获取获取
描述就提供这些,一下是代码的展示,非常的详细。
1、自定义属性的声明文件、自定义属性的声明文件
<declare-styleable name="AVLoadingIndicatorView">
<attr name="indicator">
<flag name="BallSpinFadeLoader" value="22"/>
</attr>
<attr name="indicator_color" format="color"/>
</declare-styleable>
<pre name="code" class="html">
LoadingIndicatorView.java
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Build;
import android.support.annotation.IntDef;
import android.util.AttributeSet;
import android.view.View;
import com.chni.lidong.androidtestdemo.R;
/**
* Created by lidongon 2016/1/31
*
.BallSpinFadeLoader,
*
*/
public class LoadingIndicatorView extends View {
//indicators 指示器
public static final int BallSpinFadeLoader=22;
@IntDef(flag = true,
value = {
BallSpinFadeLoader,
})
public @interface Indicator{}
//Sizes (with defaults in DP)
public static final int DEFAULT_SIZE=45;
//attrs
int mIndicatorId;
int mIndicatorColor;
Paint mPaint;
BaseIndicatorController mIndicatorController;
private boolean mHasAnimation;
public LoadingIndicatorView(Context context) {
super(context);
init(null, 0);
}
资源评论
weixin_38646706
- 粉丝: 4
- 资源: 1005
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功