本文整理汇总了Java中android.app.Dialog.dismiss方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.dismiss方法的具体用法?Java Dialog.dismiss怎么用?Java Dialog.dismiss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Dialog
的用法示例。
在下文中一共展示了Dialog.dismiss方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dismiss
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 关闭弹出框
*/
public static void dismiss(DialogInterface... dialogs) {
if (dialogs != null && dialogs.length > 0) {
for (DialogInterface dialog : dialogs) {
if (dialog instanceof Dialog) {
Dialog dialog1 = (Dialog) dialog;
if (dialog1.isShowing()) {
dialog1.dismiss();
}
} else if (dialog instanceof AppCompatDialog) {
AppCompatDialog dialog2 = (AppCompatDialog) dialog;
if (dialog2.isShowing()) {
dialog2.dismiss();
}
}
}
}
}
示例2: dismiss
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 关闭弹出框
*/
public static void dismiss(DialogInterface... dialogs) {
if (dialogs != null && dialogs.length > 0) {
for (DialogInterface dialog : dialogs) {
if (dialog instanceof Dialog) {
Dialog dialog1 = (Dialog) dialog;
if (dialog1.isShowing()) {
dialog1.dismiss();
}
} else if (dialog instanceof AppCompatDialog) {
AppCompatDialog dialog2 = (AppCompatDialog) dialog;
if (dialog2.isShowing()) {
dialog2.dismiss();
}
}
}
}
}
示例3: showDialogForAvatarOrDismiss
import android.app.Dialog; //导入方法依赖的package包/类
private void showDialogForAvatarOrDismiss(boolean showOrNotShow)
{
if (showOrNotShow)
{
avatarClickDialog = new Dialog(getActivity(), R.style.Theme_Light_Dialog);
dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.layout_dialog,null);
//获得dialog的window窗口
Window window = avatarClickDialog.getWindow();
//设置dialog在屏幕底部
window.setGravity(Gravity.BOTTOM);
//设置dialog弹出时的动画效果,从屏幕底部向上弹出
window.setWindowAnimations(R.style.dialogStyle);
window.getDecorView().setPadding(0, 0, 0, 0);
//获得window窗口的属性
android.view.WindowManager.LayoutParams lp = window.getAttributes();
//设置窗口宽度为充满全屏
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
//设置窗口高度为包裹内容
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
//将设置好的属性set回去
window.setAttributes(lp);
//将自定义布局加载到dialog上
avatarClickDialog.setContentView(dialogView);
//初始化Button
btn_camera= (Button) dialogView.findViewById(R.id.btn_camera);
btn_album= (Button) dialogView.findViewById(R.id.btn_album);
btn_cancel= (Button) dialogView.findViewById(R.id.btn_cancel);
//监听Button
btn_camera.setOnClickListener(this);
btn_album.setOnClickListener(this);
btn_cancel.setOnClickListener(this);
avatarClickDialog.show();
}
else
{
avatarClickDialog.dismiss();
}
}
示例4: tryToDismiss
import android.app.Dialog; //导入方法依赖的package包/类
private void tryToDismiss() {
supposedToBeDismissed = true;
try {
Dialog dialog = getDialog();
if (dialog != null)
dialog.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:11,代码来源:AbstractIssueReporterActivity.java
示例5: FileChooser
import android.app.Dialog; //导入方法依赖的package包/类
public FileChooser(Activity activity) {
this.activity = activity;
dialog = new Dialog(activity);
list = new ListView(activity);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
String fileChosen = (String) list.getItemAtPosition(which);
File chosenFile = getChosenFile(fileChosen);
if (chosenFile.isDirectory()) {
refresh(chosenFile);
} else {
if (fileListener != null) {
fileListener.fileSelected(chosenFile);
}
dialog.dismiss();
}
}
});
dialog.setContentView(list);
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
FileManager manager = new FileManager(activity);
try {
refresh(manager.getExternalFilesDir());
} catch (IOException e) {
dialog.dismiss();
dismissed = true;
Utils.showInformationDialog(activity.getString(R.string.external_storage_exception_title), activity.getString(R.string.external_storage_exception_message), activity, Utils.createDismissListener());
}
}
示例6: safeCloseDialog
import android.app.Dialog; //导入方法依赖的package包/类
public static void safeCloseDialog(Dialog dialog) {
if (dialog != null) {
try {
if (dialog.isShowing()) {
Activity ownerActivity = dialog.getOwnerActivity();
if (ownerActivity == null || !ownerActivity.isFinishing()) {
dialog.dismiss();
}
}
} catch (Exception e) {
Log.e(TAG, "dialog dismiss error", e);
}
}
}
示例7: safeCloseDialog
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 关闭Dialog
*/
public static void safeCloseDialog(Dialog dialog) {
try {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: dismiss
import android.app.Dialog; //导入方法依赖的package包/类
/**
* Tries to dismiss the given {@link Dialog}.
*
* @param dialog Which dialog to dismiss
* @return {@code True} if the given dialog is not {@code null}, it is currently showing and dismiss was invoked; {@code false}
* otherwise
*/
public static boolean dismiss(@Nullable final Dialog dialog) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
return true;
} else {
return false;
}
}
示例9: closeDialog
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 关闭dialog
*
* @param mDialogUtils
*/
public static void closeDialog(Dialog mDialogUtils) {
if (mDialogUtils != null && mDialogUtils.isShowing()) {
mDialogUtils.dismiss();
}
}
示例10: toDismissDialog
import android.app.Dialog; //导入方法依赖的package包/类
protected void toDismissDialog(Dialog dialog) {
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
}
}
示例11: toDismissDialog
import android.app.Dialog; //导入方法依赖的package包/类
private void toDismissDialog(Dialog dialog) {
if (dialog != null)
dialog.dismiss();
}
示例12: dismissDialog
import android.app.Dialog; //导入方法依赖的package包/类
private static void dismissDialog(Dialog dialog)
{
if (dialog != null)
dialog.dismiss();
}
示例13: closeDialog
import android.app.Dialog; //导入方法依赖的package包/类
/**
* 关闭dialog
*
* http://blog.csdn.net/qq_21376985
*
* @param mDialogUtils
*/
public static void closeDialog(Dialog mDialogUtils) {
if (mDialogUtils != null && mDialogUtils.isShowing()) {
mDialogUtils.dismiss();
}
}