Android 提供ProgressDialog,可以提示进度,但你也可以自己实现,示例如下:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_gravity="center_vertical" android:layout_width="fill_parent"android:layout_height="wrap_content"><ProgressBar android:layout_width="wrap_content"android:layout_height="wrap_content" android:id="@+id/progressbar_default"android:scaleType="fitCenter" android:layout_alignParentLeft="true"android:layout_margin="5dip" /><ProgressBar android:layout_width="fill_parent"android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal"android:id="@+id/progressbar_Horizontal" android:max="100"android:layout_toRightOf="@id/progressbar_default"android:layout_margin="5dip" /><TextView android:layout_width="fill_parent"android:layout_height="wrap_content" android:id="@+id/progressbar_text"android:layout_toRightOf="@id/progressbar_default" android:paddingTop="25dip"android:layout_margin="5dip" android:text="init text"/></RelativeLayout>

public class ClearProgressDialog extends AlertDialog implementsDialogInterface.OnClickListener {private ProgressBar progressBar;private int progress = 0;protected ClearProgressDialog(Context context) {super(context);init();}public ClearProgressDialog(Context context, boolean cancelable,OnCancelListener cancelListener) {super(context, cancelable, cancelListener);init();}public ClearProgressDialog(Context context, int theme) {super(context, theme);init();}public void init() {View view = getLayoutInflater().inflate(R.layout.progresslayout,null);progressBar = (ProgressBar) view.findViewById(R.id.progressbar_Horizontal);setButton(getContext().getText(R.string.stop), this);setIcon(R.drawable.andclear);setTitle(R.string.clear_progress);setView(view);//progressBar = (ProgressBar) findViewById(R.id.progressbar_Horizontal);}public void onClick(DialogInterface dialog, int which) {}Handler pHandle = new Handler() {public void handleMessage(Message msg) {}};public void setProgress(int per, String str) {}public void stop() {}}

更多相关文章

  1. android之实现SeekBar拖动组件
  2. 图解 Android(安卓)View动画中 android:pivotX 和 android:pivot
  3. android 学习笔记(一)
  4. 关于android LinearLayout的比例布局
  5. android 回调函数二:应用实例
  6. Android中为窗口定义主题
  7. react-native-vector-icons(android)的安装与使用
  8. android进度条
  9. android 背景圆角以及图片圆角处理

随机推荐

  1. 浅谈postgresql数据库varchar、char、tex
  2. MySQL如何优雅的删除大表实例详解
  3. 详解 MySQL 执行计划
  4. 监控MySQL主从状态的shell脚本
  5. Mysql实现定时清空一张表的旧数据并保留
  6. MySQL是如何实现主备同步
  7. MySQL如何优化索引
  8. mysql 的indexof函数用法说明
  9. MySQL 实现lastInfdexOf的功能案例
  10. 深入了解Mysql逻辑架构