自定义progressbar(类似dialog)
来源:互联网 发布:prolink ii软件下载 编辑:程序博客网 时间:2024/05/18 03:14
主要调用方法
//如dialog一样的使用方法 dialog = new MyDialog().loadingDialog(getActivity()); dialog.show(); // 隐藏 if (dialog != null && dialog.isShowing()) { dialog.dismiss(); }
public class MyDialog { public static Dialog loadingDialog(Context context) { View view = LayoutInflater.from(context).inflate(R.layout.loading_dialog, null); ImageView imageView = (ImageView) view.findViewById(R.id.img); // 加载动画 Animation animation = AnimationUtils.loadAnimation( context, R.anim.load_animation); // 使用ImageView显示动画 imageView.startAnimation(animation); Dialog loadingDialog = new Dialog(context, R.style.loading_dialog);// 创建自定义样式dialog loadingDialog.setContentView(view); return loadingDialog; }}
参考动画详细介绍
动画设置
//主要动画(在res创建anim文件夹,这里是放动画的)// load_animation<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <rotate android:duration="1500" android:fromDegrees="0" android:interpolator="@android:anim/linear_interpolator" android:pivotX="50%" android:pivotY="50%" android:repeatCount="-1" android:repeatMode="restart" android:startOffset="-1" android:toDegrees="+360" /></set>
dialog 的styles设置
<!-- 自定义loading dialog --> <style name="loading_dialog" parent="android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowNoTitle">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowIsFloating">true</item> <item name="android:windowContentOverlay">@null</item> </style>
- 图片资源R.id.img (随意改)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dialog_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent" android:padding="10dp"> <ImageView android:id="@+id/img" android:layout_width="50dp" android:layout_height="50dp" android:layout_centerInParent="true" android:src="@mipmap/dialog" /> <TextView android:id="@+id/tv_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/img" android:layout_centerHorizontal="true" android:gravity="center" android:paddingLeft="10dp" android:paddingTop="12dp" android:text="loading..." android:textColor="#00FFFF" android:textSize="12sp" /></RelativeLayout>
0 0
- 自定义progressbar(类似dialog)
- 自定义进度条对话框 (Customer ProgressBar Dialog)
- Android自定义类似ProgressDialog效果的Dialog
- 自定义Dialog实现类似Toast的功能
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- Android自定义类似ProgressDialog效果的Dialog
- javaSE数据类型
- gradle 像maven一样自定义本地仓库地址
- python exec
- c# .accdb格式access数据库压缩
- leetcode题解-287. Find the Duplicate Number
- 自定义progressbar(类似dialog)
- MATLAB中调用c++程序(函数)
- spring定时任务调度quartz
- [BZOJ 1345][Baltic2007]序列问题Sequence:单调栈
- 第七届ACM山东省赛-D Swiss-system tournament
- Java使用spring发送邮件
- leetcode数组之Rotate Image
- AVFoundation使用
- 使用u盘PE系统重装Windows操作系统