自定义ProgressBar(使用图片播放效果)
来源:互联网 发布:磁条卡读写软件 编辑:程序博客网 时间:2024/04/27 01:54
ProgressBar时在网上搜了一些样式,基本不是我想要的效果,找到一个我想要的效果的demo结果调试了半天都不出来效果,没办法放弃了,于是自己动手花了点时间写了一个。希望对大家有所帮助
1、首先一个layout布局
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/webview_loading_bg"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/webview_loading" />
</RelativeLayout>/
2、自定义一个Dialog类
public class WaitDialog extends AlertDialog {
/**
* 加载中Dialog
*
*
*/
private TextView tips_loading_msg;
private ImageView spaceshipImage;
private String message = null;
Context context;
public WaitDialog(Context context) {
super(context);
this.context = context;
}
public WaitDialog(Context context, String message) {
super(context);
this.context = context;
this.message = message;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.layout_waitdialog);
spaceshipImage = (ImageView) findViewById(R.id.img);
// 加载动画
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(
context, R.anim.loading_animation);
// 使用ImageView显示动画
spaceshipImage.startAnimation(hyperspaceJumpAnimation);
tips_loading_msg = (TextView) findViewById(R.id.tipTextView);
tips_loading_msg.setText(this.message);
}
}
3、调用
protected WaitDialog dialog = null;
public void loadProgressDialog() {
if (dialog == null) {
dialog = new WaitDialog(BaseActivity.this);
}
dialog.show();
}
- 自定义ProgressBar(使用图片播放效果)
- android progressbar 使用自定义图片时的左右两端圆角效果实现
- Android自定义progressDialog使用系统ProgressBar与图片实现(一)系统ProgressBar
- 使用颜色渐变图片自定义条形ProgressBar
- 自定义progressBar的效果
- Android自定义progressDialog使用系统ProgressBar与图片实现(二)使用图片
- 自定义ProgressBar(背景,前景,进度图片)
- progressBar自定义图片(圈圈等待)
- 自定义图片的progressbar
- ProgressBar:自定义旋转图片
- 自定义ProgressBar的加载效果
- Android Progressbar自定义菊花效果
- 自定义ProgressBar的加载效果
- 自定义ProgressBar的加载效果
- 自定义ProgressBar的加载效果
- progressBar图片旋转效果实现
- android自定义ProgressBar(仿淘宝)的加载效果
- 自定义水平的进度条(效果很炫)ProgressBar
- mysql 批量删除带有前缀的数据库表
- iOS no such provisioning profile was found
- 151104的测试总结
- android 基础再学习-linkify超链接的简单使用
- Java提高篇
- 自定义ProgressBar(使用图片播放效果)
- 【已解决】Eclipse for Android 出现Could not find SDK folder....问题解决
- cordys 的 ESB如果实现数据转换
- ostringstream的简单用法(用于一次文件内容全部读入)
- windows7安装oracle 10g安装过程及注意事项
- 内存操作GetMemory
- 创建型模式之工厂方法模式(日志记录器)
- ubifs烧写到nand flash中的几种方法
- Android动画学习笔记