Android有没有代替数据库有哪些ProgressDialog的比较好的库

android 对话框中的进度条 (ProgressDialog) - 低级写手 我自由了 - ITeye技术网站
博客分类:
&&& 显然要定义对话框进度条就要用ProgressDialog,首先我们需要创建ProgressDialog对象,当然这里同样使用了线程来控制进度条显示,另外可以使用以下方法来设置ProgressDialog。
& setProgressStyle:设置进度条风格,风格为圆形,旋转的。
& setTitlt:设置ProgressDialog 标题
& setMessage:设置ProgressDialog提示信息;
& setIcon:设置ProgressDialog标题图标;
& setIndeterminate:设置ProgressDialog 的进度条是否不明确;
& setCancelable:设置ProgressDialog 是否可以按返回键取消;
& setButton:设置ProgressDialog 的一个Button(需要监听Button事件);
& show:显示ProgressDialog。
& 首先还是让我们看看运行效果吧
&& 下面先来看看布局文件
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android="/apk/res/android"
&&& android:orientation="vertical"
&&& android:layout_width="fill_parent"
&&& android:layout_height="fill_parent"
&&& &
&TextView&
&&& android:layout_width="fill_parent"
&&& android:layout_height="wrap_content"
&&& android:text="@string/hello"
&&& /&
&Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="圆形进度条"/&
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="长形进度条"/&
&/LinearLayout&
Activity01
package xiaohang.
import android.app.A
import android.app.ProgressD
import android.content.DialogI
import android.os.B
import android.view.V
import android.view.View.OnClickL
import android.widget.B
public class Activity01 extends Activity {
private Button xhButton01, xhButton02;
int xh_count = 0;
// 声明进度条对话框
ProgressDialog xh_pD
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// 得到按钮对象
xhButton01 = (Button) findViewById(R.id.Button01);
xhButton02 = (Button) findViewById(R.id.Button02);
// 设置xhButton01的事件监听
xhButton01.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// 创建ProgressDialog对象
xh_pDialog = new ProgressDialog(Activity01.this);
// 设置进度条风格,风格为圆形,旋转的
xh_pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
// 设置ProgressDialog 标题
xh_pDialog.setTitle("提示");
// 设置ProgressDialog提示信息
xh_pDialog.setMessage("这是一个圆形进度条对话框");
// 设置ProgressDialog标题图标
xh_pDialog.setIcon(R.drawable.img1);
// 设置ProgressDialog 的进度条是否不明确 false 就是不设置为不明确
xh_pDialog.setIndeterminate(false);
// 设置ProgressDialog 是否可以按退回键取消
xh_pDialog.setCancelable(true);
// 设置ProgressDialog 的一个Button
xh_pDialog.setButton("确定", new Bt1DialogListener());
// 让ProgressDialog显示
xh_pDialog.show();
// 设置xhButton02的事件监听
xhButton02.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
xh_count = 0;
// 创建ProgressDialog对象
xh_pDialog = new ProgressDialog(Activity01.this);
// 设置进度条风格,风格为圆形,旋转的
xh_pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
// 设置ProgressDialog 标题
xh_pDialog.setTitle("提示");
// 设置ProgressDialog提示信息
xh_pDialog.setMessage("这是一个长形进度条对话框");
// 设置ProgressDialog标题图标
xh_pDialog.setIcon(R.drawable.img2);
// 设置ProgressDialog 的进度条是否不明确 false 就是不设置为不明确
xh_pDialog.setIndeterminate(false);
// 设置ProgressDialog 进度条进度
xh_pDialog.setProgress(100);
// 设置ProgressDialog 是否可以按退回键取消
xh_pDialog.setCancelable(true);
// 让ProgressDialog显示
xh_pDialog.show();
new Thread() {
public void run() {
while (xh_count &= 100) {
// 由线程来控制进度
xh_pDialog.setProgress(xh_count++);
Thread.sleep(100);
xh_pDialog.cancel();
} catch (Exception e) {
xh_pDialog.cancel();
}.start();
// xhButton01的监听器类
class Bt1DialogListener implements DialogInterface.OnClickListener {
public void onClick(DialogInterface dialog, int which) {
// 点击“确定”按钮取消对话框
dialog.cancel();
android 2.0&
源码 运行效果图片 见附件
(152.6 KB)
下载次数: 632
浏览 24093
浏览: 1425567 次
来自: 北京
[color=red][/color]
[flash=200,200][flash=200,200][ ...
写的还不错,不过不是我需要的。
牛逼,太齐全了,收藏关注微口网微博
微信号:iweikou
简介这篇文章介绍CircleProgressDialog开源库的运用及完结的具体进程,该开源库首要完结以下几个功用:自界说一个美丽的圆形翻开条,可直接在规划文件中运用,可设置圆环宽度、圆环色彩、圆环暗影巨细等特征;完结自界说的dialog,用于用户等候时的闪现,通过简略的代码即可直接调用闪现,一同供应api进行色彩、文字等设置通过这篇文章可了解到自界说view的有关常识及自界说dialog的办法github衔接如下,觉得还能够请帮忙点下star~运用作用首要看下运用作用:(图一)有两种运用办法规划文件中运用供应loading_color、loading_width、shadow_offset进行设置(图二)代码中运用,对话框办法弹出假设直接选用默认设置直接调用以下代码即可(图三)当然,还能够进行有关特征的设置,一同在等候的进程中可依据程序作业状况动态改动提示文字的内容及色彩(图四)当然在运用前需先导入该库,仅需参加两行代码:在工程的 build.gradle中参加:(图五)module的build.gradle中参加依托:(图六)具体完结进程自界说view有关常识制造弧:drawArc (RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)oval是RecF类型的方针,其界说了椭圆的形状startAngle指的是制造的开端视点,挂钟的3点方位对应着0度,假设传入的startAngle小于0或许大于等于360,那么用startAngle对360进行取模后作为开端制造视点。sweepAngle指的是从startAngle开端沿着挂钟的顺时针方向旋转扫过的视点。假设sweepAngle大于等于360,那么会制造无缺的椭圆环。假设sweepAngle小于0,那么会用sweepAngle对360进行取模后作为扫过的视点。useCenter是个boolean值,假设为true,标明在制造完环往后,用椭圆的基地址衔接环上的起点和结尾以闭合环;假设值为false,标明在制造完环往后,环的起点和结尾直接衔接,不通过椭圆的基地址。设置矩形:RectF rectF = new RectF(100, 100, 300, 300);这四个参数别离代表的意思是:left top right bottom 左 上 右 下left : 矩形左面的X坐标top: 矩形顶部的Y坐标right : 矩形右边的X坐标bottom: 矩形底部的Y坐标正本即是矩形的左上角和右下角的坐标值首要参加自界说view的特征咱们界说了色彩,宽度,暗影偏移巨细,是不是闪现等特征,format是值该特征的取值类型:总共有:string,color,demension,integer,enum,reference,float,boolean,fraction,(图七)编写自界说view–RotateLoading预设有关特征(图八)获取自界说特征(图九)Paint初始化(图一十)初始化制造弧形所需的RectF(图一十一)重写onDraw,绘出图形(图一十二)(图一十三)至此,圆形翻开条就完结了,无缺的代码可在github上检查边写自界说dialog编写规划文件即是放入方才自界说的RotateLoading,一同在下面放入一个文本(图一十四)预设有关特征(图一十五)初始化配备(图一十六)调用闪现对话框加载方才的规划文件,调用自界说view的闪现(图一十七)供应给用户的API包富含关特征的set办法及两个改动文字特征的办法(图一十八)ok,至此,自界说dialog也完结了。总结这篇文章介绍了CircleProgressDialog开源库的运用及正本现办法,借此也介绍了自界说view及自界说dialog的办法。
关键字: 对话框,开源,进度,圆形,好看,看的,简单,使用,自定义,圆环,实现,文件,布局
看过本文的人还看过
人气:1334 更新:
人气:656 更新:
人气:536 更新:
人气:481 更新:
java一日一条的更多文章
大家在看 ^+^
推荐阅读 ^o^
『中國邊疆研究與歷史書寫』研討會日程安排
过真伤己、过直伤人
中国人走得太远太快,灵魂跟不上了(深度好文)
他说第二,有人敢说第一吗?
猜你喜欢 ^_^
24小时热门文章
微信扫一扫
分享到朋友圈记住登录一个月发表随想还能输入:200字该用户最新代码编程随想&by by by by by by [android]代码库import android.app.A
import android.app.ProgressD
import android.os.B
import android.view.V
import android.widget.B
import android.widget.TextV
public class EX03_18 extends Activity {
private Button mButton1;
private TextView mTextView1;
public ProgressDialog myDialog =
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mButton1 = (Button) findViewById(R.id.myButton1);
mTextView1 = (TextView) findViewById(R.id.myTextView1);
mButton1.setOnClickListener(myShowProgressBar);
Button.OnClickListener myShowProgressBar = new Button.OnClickListener() {
public void onClick(View arg0) {
final CharSequence strDialogTitle = getString(R.string.str_dialog_title);
final CharSequence strDialogBody = getString(R.string.str_dialog_body);
// 显示Progress对话框
myDialog = ProgressDialog.show(EX03_18.this, strDialogTitle,
strDialogBody, true);
mTextView1.setText(strDialogBody);
new Thread() {
public void run() {
/* 在这里写上要背景执行的程序片段 */
/* 为了明显看见效果,以暂停3秒作为示范 */
sleep(3000);
} catch (Exception e) {
e.printStackTrace();
} finally { // 卸除所建立的myDialog对象。
myDialog.dismiss();
}.start(); /* 开始执行线程 */
/* End: public void onClick(View arg0) */
}[代码运行效果截图]分享到:更多发表评论:评论须知:1、评论每次加2分,每天上限为30;2、请文明用语,共同创建干净的技术交流环境;3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。Android自定义类似ProgressDialog效果的Dialog - 博客频道 - CSDN.NET
钱进的专栏
一些技术备忘录
分类:Android
(116698)
Android自定义类似ProgressDialog效果的Dialog.
方法如下:
1.首先准备两张自己要定义成哪样子的效果的图片和背景图片(也可以不要背景)。
如我要的效果:
2.定义loading_dialog.xml布局文件(这里你也可以按自己的布局效果定义,关键是要有个imageView):
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:id=&@+id/dialog_view&
android:orientation=&vertical&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:minHeight=&60dp&
android:minWidth=&180dp&
android:gravity=&center&
android:padding=&10dp&
android:background=&@drawable/loading_bg&&
&ImageView
android:id=&@+id/img&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:src=&@drawable/publicloading&
android:id=&@+id/tipTextView&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_marginLeft=&10dp&
android:text=&数据加载中……& /&
&/LinearLayout&
3.定义一个loadingDialog中imageView转动的动画:loading_animation.xml
&?xml version=&1.0& encoding=&utf-8&?&
&set android:shareInterpolator=&false& xmlns:android=&/apk/res/android&&
android:interpolator=&@android:anim/linear_interpolator&
android:pivotX=&50%&
android:pivotY=&50%&
android:fromDegrees=&0&
android:toDegrees=&+360&
android:duration=&1500&
android:startOffset=&-1&
android:repeatMode=&restart&
android:repeatCount=&-1&/&
4.定义dialog的style.
&!-- 自定义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&&@drawable/loading_bg&/item&
&item name=&android:windowIsFloating&&true&/item&
&item name=&android:windowContentOverlay&&@null&/item&
5.写点创建Dialog的代码,你可以自己封装成一个方法。
* 得到自定义的progressDialog
* @param context
* @param msg
public static Dialog createLoadingDialog(Context context, String msg) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.loading_dialog, null);// 得到加载view
LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 加载布局
// main.xml中的ImageView
ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img);
TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// 提示文字
// 加载动画
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(
context, R.anim.load_animation);
// 使用ImageView显示动画
spaceshipImage.startAnimation(hyperspaceJumpAnimation);
tipTextView.setText(msg);// 设置加载信息
Dialog loadingDialog = new Dialog(context, R.style.loading_dialog);// 创建自定义样式dialog
loadingDialog.setCancelable(false);// 不可以用“返回键”取消
loadingDialog.setContentView(layout, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT));// 设置布局
return loadingD
最后来张整体的效果图:
排名:第6234名
(28)(11)(0)(1)(17)(5)(1)(2)(1)(0)(1)
(116693)
(107719)}

我要回帖

更多关于 代替数据库有哪些 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信