當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。