当前位置: 首页>>代码示例>>Java>>正文


Java Dialog.dismiss方法代码示例

本文整理汇总了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();
                }
            }
        }

    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DialogUIUtils.java

示例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();
                }
            }
        }

    }


}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:24,代码来源:DialogUIUtils.java

示例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();
    }
}
 
开发者ID:WindFromFarEast,项目名称:SmartButler,代码行数:39,代码来源:UserFragment.java

示例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());
    }
}
 
开发者ID:AbyxBelgium,项目名称:Loyalty,代码行数:32,代码来源:FileChooser.java

示例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);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:SocializeUtils.java

示例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();
    }
}
 
开发者ID:zhonglikui,项目名称:cardinalsSample,代码行数:13,代码来源:DialogUtil.java

示例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;
    }
}
 
开发者ID:milosmns,项目名称:silly-android,代码行数:16,代码来源:SillyAndroid.java

示例9: closeDialog

import android.app.Dialog; //导入方法依赖的package包/类
/**
 * 关闭dialog
 *
 * @param mDialogUtils
 */
public static void closeDialog(Dialog mDialogUtils) {
    if (mDialogUtils != null && mDialogUtils.isShowing()) {
        mDialogUtils.dismiss();
    }
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:11,代码来源:DefaultDialogUtils.java

示例10: toDismissDialog

import android.app.Dialog; //导入方法依赖的package包/类
protected void toDismissDialog(Dialog dialog) {
    if (dialog != null && dialog.isShowing()) {
        dialog.dismiss();
    }
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:6,代码来源:AgentWebUIController.java

示例11: toDismissDialog

import android.app.Dialog; //导入方法依赖的package包/类
private void toDismissDialog(Dialog dialog) {
    if (dialog != null)
        dialog.dismiss();

}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:6,代码来源:DefaultChromeClient.java

示例12: dismissDialog

import android.app.Dialog; //导入方法依赖的package包/类
private static void dismissDialog(Dialog dialog)
{
    if (dialog != null)
        dialog.dismiss();
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:6,代码来源:RMBTTestFragment.java

示例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();
    }
}
 
开发者ID:MedicationReminder,项目名称:MedicationReminder,代码行数:13,代码来源:DialogThridUtils.java


注:本文中的android.app.Dialog.dismiss方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。