android中的自定义主题,Android自定义主题(3)

package com.example.august.customtheme;

import android.app.Dialog;

import android.content.Context;

import android.graphics.Bitmap;

import android.view.LayoutInflater;

import android.view.View;

import android.view.animation.AccelerateInterpolator;

import android.view.animation.Animation;

import android.view.animation.RotateAnimation;

import android.widget.ImageView;

import android.widget.TextView;

public class CustomProgressDialog extends Dialog {

/**

* 从我们的布局文件loading_layout加载的View

*/

private View mContentView;

/**

* 我们的两个小空控件,显示图片和显示文字

*/

private ImageView mImageView;

private TextView mTextView;

/**

* 我们只去覆写指定主题的方法,并且我们就只有这么一个构造器

* @param context

* @param themeResId

* @param LayoutID

* @param imageViewID

* @param textViewID

*/

public CustomProgressDialog(Context context, int themeResId, int LayoutID, int imageViewID, int textViewID) {

super(context, themeResId);

mContentView = LayoutInflater.from(context).inflate(LayoutID, null);

mImageView = (ImageView) mContentView.findViewById(imageViewID);

/**

* 为图片设置一个旋转动画

*/

RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

rotateAnimation.setInterpolator(new AccelerateInterpolator());

rotateAnimation.setDuration(1500);

rotateAnimation.setRepeatCount(-1);

mImageView.startAnimation(rotateAnimation);

mTextView = (TextView) mContentView.findViewById(textViewID);

setContentView(mContentView);

}

public void setMessage(String text) {

if (mTextView != null) {

mTextView.setText(text);

}

}

public void setProgressBitmap(Bitmap bitmap) {

if (mImageView != null) {

mImageView.setImageBitmap(bitmap);

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值