ProgressDialog(一)——常用ProgressDialog设置

简介: public static ProgressDialog initDialog(Context context) { ProgressDialog progressDialog = new ProgressDialog(context); progressDialog.
public static ProgressDialog initDialog(Context context) {
		ProgressDialog progressDialog = new ProgressDialog(context);
		progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
		progressDialog.setCanceledOnTouchOutside(false);
		progressDialog.setMessage("loading...");
		//使其按下Back键无用
		progressDialog.setCancelable(false);
		//使其点击对话框以外的地方不起作用
		progressDialog.setCanceledOnTouchOutside(false);
		//使其按下Search键无用
		progressDialog.setOnKeyListener(new OnKeyListener() {
			@Override
			public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
				if (keyCode==KeyEvent.KEYCODE_SEARCH) {
					return true;
				}
				return false;
			}
		});
		return progressDialog;
	}

相关文章
|
XML 数据格式
DrawerLayout侧滑菜单、Toolbar和沉浸式状态栏的使用
DrawerLayout侧滑菜单、Toolbar和沉浸式状态栏的使用
|
API Android开发 容器
PopupWindow
PopupWindow
197 0
AlertDialog 背景透明
AlertDialog 背景透明
214 0
Dialog和DialogFragment 设置背景透明
Dialog和DialogFragment 设置背景透明
1112 0