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


Java Dialog.setCanceledOnTouchOutside方法代码示例

本文整理汇总了Java中android.app.Dialog.setCanceledOnTouchOutside方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setCanceledOnTouchOutside方法的具体用法?Java Dialog.setCanceledOnTouchOutside怎么用?Java Dialog.setCanceledOnTouchOutside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Dialog的用法示例。


在下文中一共展示了Dialog.setCanceledOnTouchOutside方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateDialog

import android.app.Dialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    dialog.setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setOnDismissListener(this);


    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    return dialog;
}
 
开发者ID:nidhinvv,项目名称:BubbleAlert,代码行数:17,代码来源:BblDialogFragmentBase.java

示例2: onCreateDialog

import android.app.Dialog; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // the content
    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    // creating the fullscreen dialog
    final Dialog dialog = new Dialog(getContext());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    if (dialog.getWindow() != null) {
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.getWindow().setLayout(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
    }
    dialog.setCanceledOnTouchOutside(false);

    return dialog;
}
 
开发者ID:MindorksOpenSource,项目名称:android-mvp-architecture,代码行数:24,代码来源:BaseDialog.java

示例3: createSubDialog

import android.app.Dialog; //导入方法依赖的package包/类
/**
 * 创建次级目录的弹窗
 * 可以重写该方法修改弹窗的样式 及 动画
 * 注意添加自定义View是无效的
 * 自定义View需要重写{@link #getSubContent()}
 *
 * @return
 */
protected Dialog createSubDialog() {
    Dialog dialog = new Dialog(getContext(), R.style.ClassifyViewTheme);
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
    layoutParams.gravity = Gravity.BOTTOM;
    layoutParams.height = (int) (getHeight() * mSubRatio);
    layoutParams.dimAmount = 0.6f;
    layoutParams.windowAnimations = R.style.DefaultAnimation;
    layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
    layoutParams.flags |= WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}
 
开发者ID:AlphaBoom,项目名称:ClassifyView,代码行数:24,代码来源:ClassifyView.java

示例4: a

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog a(Context context, String str, String str2, String str3, OnClickListener onClickListener, String str4, OnClickListener onClickListener2) {
    Builder builder = new Builder(context);
    if (a) {
        if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
            builder.setPositiveButton(str4, onClickListener2);
        }
        if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
            builder.setNegativeButton(str3, onClickListener);
        }
    } else {
        if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
            builder.setPositiveButton(str3, onClickListener);
        }
        if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
            builder.setNegativeButton(str4, onClickListener2);
        }
    }
    builder.setTitle(str);
    builder.setMessage(str2);
    Dialog create = builder.create();
    create.setCanceledOnTouchOutside(false);
    create.setOnKeyListener(new e());
    try {
        create.show();
    } catch (Throwable th) {
    }
    return create;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:d.java

示例5: alertDialogUntilBundleProcessed

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog alertDialogUntilBundleProcessed(Activity activity,String bundleName){
    if (activity != null) {
        if(sReminder!=null){
            return sReminder.createReminderDialog(activity,bundleName);
        }else {
            Dialog dialog = new Dialog(activity, R.style.atlas_default_dialog);
            dialog.setCanceledOnTouchOutside(false);
            dialog.setCancelable(true);
            DefaultProgress progress = new DefaultProgress(activity);
            float density = delegateResources.getDisplayMetrics().density;
            int size = (int) (96 * density);
            ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(size, size);
            dialog.setContentView(progress, params);
            return dialog;
        }
    }
    return null;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:19,代码来源:RuntimeVariables.java

示例6: init

import android.app.Dialog; //导入方法依赖的package包/类
private void init() {
	mAlertDialog = new Dialog(context);
	mAlertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mAlertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));

	LinearLayout alertLayout = (LinearLayout) LinearLayout.inflate(
			context, R.layout.waiting_dialog, null);

	TextView alertHeader = (TextView) alertLayout
			.findViewById(R.id.waiting_title);
	alertHeader.setText(title);
	
	mAlertDialog.setCanceledOnTouchOutside(false);
	mAlertDialog.setContentView(alertLayout);
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:16,代码来源:DialogLoading.java

示例7: showTips

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog showTips(Context context, String title, String des, String btn, DialogInterface.OnDismissListener dismissListener) {
    AlertDialog.Builder builder = dialogBuilder(context, title, des);
    builder.setCancelable(true);
    builder.setPositiveButton(btn, null);
    Dialog dialog = builder.show();
    dialog.setCanceledOnTouchOutside(true);
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}
 
开发者ID:jqjm,项目名称:Liteframework,代码行数:10,代码来源:DialogUtil.java

示例8: getDialog

import android.app.Dialog; //导入方法依赖的package包/类
private static Dialog getDialog(Context context, int layoutId) {
    Dialog dialog = new Dialog(context, R.style.defaultDialogStyle);
    dialog.setContentView(layoutId);
    dialog.getWindow().getAttributes().gravity = Gravity.CENTER; //居中
    dialog.setCanceledOnTouchOutside(true); //点击空白不取消
    dialog.setCancelable(false); //点击返回按钮不取消
    return dialog;
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:9,代码来源:DialogCreater.java

示例9: doCaptureKey

import android.app.Dialog; //导入方法依赖的package包/类
public Dialog doCaptureKey(){
	
	final Dialog d = new Dialog(_gamePadActivity);
	d.setContentView(R.layout.prefs_capture_key);
	d.setCanceledOnTouchOutside(true);
	d.setOnKeyListener(new Dialog.OnKeyListener() {
           @Override
           public boolean onKey(DialogInterface arg0, int keyCode,
                   KeyEvent event) {
           	_setActionKey(keyCode);
           	d.dismiss();
               return true;
           }
       });
	
	Button b = (Button)d.findViewById(R.id.buttonResetToDefault);
	b.setOnClickListener(new Button.OnClickListener(){
		@Override
		public void onClick(View v) {
			switch(_captureKey){
			case PICK_UP: _setActionKey(KeyEvent.KEYCODE_BUTTON_Y); break;
			case JUMP: _setActionKey(KeyEvent.KEYCODE_BUTTON_A); break;
			case PUNCH: _setActionKey(KeyEvent.KEYCODE_BUTTON_X); break;
			case BOMB: _setActionKey(KeyEvent.KEYCODE_BUTTON_B); break;
			case RUN1: _setActionKey(KeyEvent.KEYCODE_BUTTON_L1); break;
			case RUN2: _setActionKey(KeyEvent.KEYCODE_BUTTON_R1); break;
			case START: _setActionKey(KeyEvent.KEYCODE_BUTTON_START); break;
			default:
				LogThread.log("Error: unrecognized key in doActionKey",null);
				break;
			}
			d.dismiss();
		}});

	d.setTitle(R.string.capturing);
	d.show();
	return d;
}
 
开发者ID:efroemling,项目名称:bombsquad-remote-android,代码行数:39,代码来源:GamePadActivity.java

示例10: showLoading

import android.app.Dialog; //导入方法依赖的package包/类
public static Dialog showLoading(Context context) {
    Dialog loadingdialog = new Dialog(context, R.style.loadingStyle);
    loadingdialog.setContentView(R.layout.loading);
    Window dialogWindow = loadingdialog.getWindow();
    dialogWindow.setGravity(Gravity.CENTER);
    loadingdialog.setCanceledOnTouchOutside(false);
    loadingdialog.setCancelable(true);
    return loadingdialog;
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:10,代码来源:AlertUtil.java

示例11: setCancelable

import android.app.Dialog; //导入方法依赖的package包/类
@Override
public void setCancelable(boolean cancelable) {
    super.setCancelable(cancelable);
    Dialog dialog = getDialog();
    if (dialog != null) {
        dialog.setCanceledOnTouchOutside(cancelable);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:9,代码来源:BaseDialogFragment.java

示例12: createDialog

import android.app.Dialog; //导入方法依赖的package包/类
public Dialog createDialog(Context context,boolean isCancel) {
    View view = LayoutInflater.from(context).inflate(R.layout.dialog_update, null);// 得到加载view
    progressBar = (NumberProgressBar) view.findViewById(R.id.progress_bar);
    dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);  //http://blog.csdn.net/u011747761/article/details/47419419
    dialog.setCancelable(isCancel);
    dialog.setCanceledOnTouchOutside(isCancel);
    dialog.show();
    dialog.addContentView(view, new RelativeLayout.LayoutParams(
            DensityConversionUtil.dpToPx(context, 250),
            DensityConversionUtil.dpToPx(context, 100)));
    return dialog;
}
 
开发者ID:LonelyMushroom,项目名称:LonelyM-ViewLib,代码行数:14,代码来源:DialogUpdateWidget.java

示例13: showDialogForView

import android.app.Dialog; //导入方法依赖的package包/类
private void showDialogForView(View view) {
    mDialog = new Dialog(mActivity) {
        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            super.onWindowFocusChanged(hasFocus);
            if (!hasFocus) super.dismiss();
        }
    };
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.addContentView(view,
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                                          LinearLayout.LayoutParams.MATCH_PARENT));
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mItemSelectedCallback.onItemSelected("");
        }
    });

    Window window = mDialog.getWindow();
    if (!DeviceFormFactor.isTablet(mActivity)) {
        // On smaller screens, make the dialog fill the width of the screen,
        // and appear at the top.
        window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
        window.setGravity(Gravity.TOP);
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
                         ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    mDialog.show();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:ItemChooserDialog.java

示例14: onCreateDialog

import android.app.Dialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new AlertDialog.Builder(getContext())
            .setTitle(R.string.key_sig_dialog_title)
            .setView(R.layout.dialog_key_sig)
            .setPositiveButton(R.string.ok, (d, w) -> dismiss(true))
            .create();

    setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    return dialog;
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:13,代码来源:KeySigDialogFragment.java

示例15: onCreateDialog

import android.app.Dialog; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new AlertDialog.Builder(getContext())
            .setTitle(R.string.precision_dialog_title)
            .setView(R.layout.dialog_precision)
            .setPositiveButton(R.string.ok, (d, w) -> dismiss(true))
            .create();

    setCancelable(false);
    dialog.setCanceledOnTouchOutside(false);
    return dialog;
}
 
开发者ID:joshschriever,项目名称:LiveNotes,代码行数:13,代码来源:PrecisionDialogFragment.java


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