弹出框
来源:互联网 发布:阿里云 docker 编辑:程序博客网 时间:2024/05/18 03:39
package com.example.ui;import android.os.Bundle;import android.app.Activity;import android.app.AlertDialog;import android.app.ProgressDialog;import android.content.DialogInterface;import android.view.LayoutInflater;import android.view.Menu;import android.view.View;import android.widget.ProgressBar;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);AlertDialog ad=new AlertDialog.Builder(MainActivity.this).setTitle("登陆提示").setMessage("是否登录").setPositiveButton("确定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {ok();}}).setNegativeButton("取消", new DialogInterface.OnClickListener(){@Overridepublic void onClick(DialogInterface dialog, int which) {}}).create();ad.show();}protected void ok() {LayoutInflater factory=LayoutInflater.from(MainActivity.this);View DialogView=factory.inflate(R.layout.dialog, null);AlertDialog dlg=new AlertDialog.Builder(MainActivity.this).setTitle("等待框").setView(DialogView).setPositiveButton("确定", new DialogInterface.OnClickListener() {private ProgressDialog p_dialog;@Overridepublic void onClick(DialogInterface dialog, int which) {//进度条p_dialog=ProgressDialog.show(MainActivity.this, "请等待", "正在为您登陆...",true);new Thread(new Runnable() {@Overridepublic void run() {try {Thread.sleep(3000);} catch (InterruptedException e) {e.printStackTrace();}finally{p_dialog.dismiss();}}}).start();}}).setNegativeButton("取消", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {// TODO Auto-generated method stub}}).create();dlg.show();}}
0 0
- 弹出层弹出框
- 弹出框:
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- 弹出框
- java命令行运行:找不到或无法加载主类
- 作为面试官,告诉你们互联网公司需要什么样的人
- 80端口被System占用的问题
- 马伊琍,你好样的
- C++中覆盖和隐藏
- 弹出框
- 常见文件操作 - iOS开发
- VisionMobile:剥光Android
- 求指点
- 【ffmpeg学习】Tutorial 04: Spawning Threads 将解析线程与视频解码线程分开
- android Toast 消息提示 例子
- HTML5 LocalStorage 本地存储
- 简单工厂模式
- java中synchronized的用法详解