Android Dialog大集合
来源:互联网 发布:java println 编辑:程序博客网 时间:2024/04/30 06:55
- 提示 AlertDialog
private void initDefaultAlertDialog() { Dialog dialog = new AlertDialog.Builder(context).setTitle("are you ok?").setMessage("read 3 times!") .setNegativeButton("yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(context, "yes", Toast.LENGTH_SHORT).show(); } }) .setNeutralButton("no", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(context, "NO", Toast.LENGTH_SHORT).show(); } }).create(); dialog.show(); }
2 DatePickDialog 日期选择Dialog
private void initDatePackDialog() { Dialog dialog = new DatePickerDialog(context, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { String info = "\"更新日期为:\" + year + \"年-\" + (monthOfYear + 1) + \"月-\" + dayOfMonth + \"日\""; Toast.makeText(context, info, Toast.LENGTH_SHORT).show(); } }, 1998, 03, 23); dialog.show(); }
3 进度条1
//加载进度条 private void initProgressDialog() { dialog = ProgressDialog.show(context, "loading..", "wait"); new Thread(new Runnable() { @Override public void run() { try { new Thread().sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } finally { dialog.dismiss(); } } }).start(); }
进度条2
/** * 水平数字进度条 * dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); * * public static final int STYLE_SPINNER = 0; * * public static final int STYLE_HORIZONTAL = 1; */ private void initProgressDialogStyle() { dialog = new ProgressDialog(context); dialog.setTitle("title"); dialog.setMessage("message"); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMax(100); dialog.setProgress(0); dialog.onStart(); dialog.show(); new Thread(new Runnable() { @Override public void run() { for (int i = 0; i < 100; i++) { try { Thread.sleep(400); } catch (InterruptedException e) { e.printStackTrace(); } dialog.incrementProgressBy(1); } dialog.dismiss(); } }).start(); }
0 0
- Android Dialog大集合
- Dialog对话框大集合
- android dialog集合
- Android常用Dialog集合
- android dialog 收集整理集合 自己的dialog库
- Android开发之Dialog对话框集合
- android 线程大集合
- android popupwindow大集合
- android Utils大集合
- Dialog集合
- android开发资料大集合
- android 学习链接大集合
- Android 开发资料大集合
- Android 学习资料大集合
- android sdk manager 大集合
- android控件实例大集合
- Android面试题大集合
- Android大牛博客地址集合
- 计算机辅助设计与制造技术的结合
- VR 终极选购指南:入门、进阶与高端
- 生还是死?Android 进程优先级详解
- jvm
- JVM性能调优监控工具jps、jstack、jmap、jhat、jstat使用详解
- Android Dialog大集合
- 千里之行,始于足下。何时踏足,始于此20160308
- 一个用来定位当前城市的单例
- iOS隐藏状态栏
- 工作问题纪录
- Angularjs学习笔记
- 创建项目骨架
- 史上最详细最容易理解的HMM文章
- 争取几句话描述一下爬山法,模拟退火,遗传算法