當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialog.setContentView方法代碼示例

本文整理匯總了Java中android.app.Dialog.setContentView方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.setContentView方法的具體用法?Java Dialog.setContentView怎麽用?Java Dialog.setContentView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Dialog的用法示例。


在下文中一共展示了Dialog.setContentView方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: optionLegend

import android.app.Dialog; //導入方法依賴的package包/類
private void optionLegend() {
	// Show help
	Dialog dialog = new Dialog(ActivityApp.this);
	dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
	dialog.setTitle(R.string.menu_legend);
	dialog.setContentView(R.layout.legend);
	dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));

	((ImageView) dialog.findViewById(R.id.imgHelpHalf)).setImageBitmap(getHalfCheckBox());
	((ImageView) dialog.findViewById(R.id.imgHelpOnDemand)).setImageBitmap(getOnDemandCheckBox());

	for (View child : Util.getViewsByTag((ViewGroup) dialog.findViewById(android.R.id.content), "main"))
		child.setVisibility(View.GONE);

	((LinearLayout) dialog.findViewById(R.id.llUnsafe)).setVisibility(PrivacyManager.cVersion3 ? View.VISIBLE
			: View.GONE);

	dialog.setCancelable(true);
	dialog.show();
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:21,代碼來源:ActivityApp.java

示例2: FileChooser

import android.app.Dialog; //導入方法依賴的package包/類
public FileChooser(Activity activity, File initialPath) {
    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);
    if (initialPath != null) {
        refresh(initialPath);
    }else{
        refresh(Environment.getExternalStorageDirectory());
    }
}
 
開發者ID:chooka888,項目名稱:BluetoothDuck,代碼行數:27,代碼來源:FileChooser.java

示例3: setupDialog

import android.app.Dialog; //導入方法依賴的package包/類
@Override
public void setupDialog(Dialog dialog, int style) {
    LogUtils.footPrint();
    super.setupDialog(dialog, style);
    View contentView = View.inflate(getContext(), R.layout.fragment_add_list_dialog, null);
    dialog.setContentView(contentView);
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) contentView.getParent()).getLayoutParams();
    CoordinatorLayout.Behavior behavior = params.getBehavior();

    if (behavior != null && behavior instanceof BottomSheetBehavior) {
        BottomSheetBehavior bottomSheetBehavior = ((BottomSheetBehavior) behavior);
        bottomSheetBehavior.setBottomSheetCallback(bottomSheetBehaviorCallback);
    }

    ButterKnife.bind(this, contentView);

    Window window = dialog.getWindow();
    if (window != null) {
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }

    presenter = new AddListPresenter(TodoRepository.getInstance());
    presenter.attachView(this);
}
 
開發者ID:mengdd,項目名稱:TodoRealm,代碼行數:25,代碼來源:AddListDialogFragment.java

示例4: 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-interactor-architecture,代碼行數:24,代碼來源:BaseDialog.java

示例5: JumpToPopup

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * Public constructor
 *
 * @param context Application context
 */
public JumpToPopup(Context context) {
    this.context = context;
    jumpDialog = new Dialog(context);
    jumpDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    jumpDialog.setContentView(R.layout.jumb_to_popup);
    initDialogComponents();
    jumpDialog.show();
}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:14,代碼來源:JumpToPopup.java

示例6: showA1cDialog

import android.app.Dialog; //導入方法依賴的package包/類
private void showA1cDialog() {
    final Dialog a1CDialog = new Dialog(getActivity(), R.style.GlucosioTheme);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(a1CDialog.getWindow().getAttributes());
    a1CDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    a1CDialog.setContentView(R.layout.dialog_a1c);
    a1CDialog.getWindow().setAttributes(lp);
    a1CDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    a1CDialog.getWindow().setDimAmount(0.5f);
    a1CDialog.setCanceledOnTouchOutside(true);
    a1CDialog.show();

    ListView a1cListView = (ListView) a1CDialog.findViewById(R.id.dialog_a1c_listview);

    A1cEstimateAdapter customAdapter = new A1cEstimateAdapter(
            getActivity(), R.layout.dialog_a1c_item, presenter.getA1cEstimateList());

    a1cListView.setAdapter(customAdapter);
}
 
開發者ID:adithya321,項目名稱:SOS-The-Healthcare-Companion,代碼行數:23,代碼來源:OverviewFragment.java

示例7: builder

import android.app.Dialog; //導入方法依賴的package包/類
public CustomAlertPPtDialog builder() {
    view = LayoutInflater.from(context).inflate(R.layout.view_alertdialog, null);

    lLayout_bg = (LinearLayout) view.findViewById(R.id.layout_bg);
    txt_title = (TextView) view.findViewById(R.id.txt_title);
    txt_title.setVisibility(View.GONE);
    txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    txt_msg.setVisibility(View.GONE);
    et_input = (EditText) view.findViewById(R.id.et_input);
    et_input.setVisibility(View.GONE);
    btn_neg = (Button) view.findViewById(R.id.btn_neg);
    btn_neg.setVisibility(View.GONE);
    btn_pos = (Button) view.findViewById(R.id.btn_pos);
    btn_pos.setVisibility(View.GONE);
    btn_mid = (Button) view.findViewById(R.id.btn_mid);
    btn_mid.setVisibility(View.GONE);
    line1 = (ImageView) view.findViewById(R.id.line1);
    line1.setVisibility(View.GONE);
    line2 = (ImageView) view.findViewById(R.id.line2);
    line2.setVisibility(View.GONE);

    dialog = new Dialog(context, R.style.AlertDialogStyle);
    dialog.setContentView(view);

    lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (
            display.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));

    return this;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:30,代碼來源:CustomAlertPPtDialog.java

示例8: getDialog

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * dialog在單例的模式下,隻適用於同一個Context,因為每一個activity的context都不是同一個對象。
 * 而application是單例的,但是dialog不能通過application來new出。
 * 故:隻能在每一個activity保持單獨的一個dialog。不同的activity需要重新new 出來
 *
 * @param mActivity
 * @param view
 * @return
 */
public static Dialog getDialog(Context mActivity, View view) {
    if (Activity != mActivity) {
        Activity = mActivity;
        dialog = new Dialog(mActivity, R.style.Dialog_FS); // 設置全屏樣式
    }
    dialog.setContentView(view); // 設置dialog的布局

    return dialog;
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:19,代碼來源:BaseDialog.java

示例9: initDialog

import android.app.Dialog; //導入方法依賴的package包/類
private void initDialog() {

        LayoutInflater inflater = LayoutInflater.from(mContext);
        View mProgressDialogView = inflater.inflate(R.layout.mn_progress_bar_dialog_layout, null);// 得到加載view
        mDialog = new Dialog(mContext, R.style.MNCustomDialog);// 創建自定義樣式dialog
        mDialog.setCancelable(false);// 不可以用“返回鍵”取消
        mDialog.setCanceledOnTouchOutside(false);
        mDialog.setContentView(mProgressDialogView);// 設置布局

        //設置整個Dialog的寬高
        DisplayMetrics dm = new DisplayMetrics();
        WindowManager windowManager = ((Activity) mContext).getWindowManager();
        windowManager.getDefaultDisplay().getMetrics(dm);
        int screenW = dm.widthPixels;
        int screenH = dm.heightPixels;

        WindowManager.LayoutParams layoutParams = mDialog.getWindow().getAttributes();
        layoutParams.width = screenW;
        layoutParams.height = screenH;
        mDialog.getWindow().setAttributes(layoutParams);

        //獲取布局
        dialog_window_background = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_window_background);
        dialog_view_bg = (RelativeLayout) mProgressDialogView.findViewById(R.id.dialog_view_bg);
        tvShow = (TextView) mProgressDialogView.findViewById(R.id.tvShow);
        horizontalProgressBar = (ProgressBar) mProgressDialogView.findViewById(R.id.horizontalProgressBar);
        circularProgressBar = (MCircularProgressBar) mProgressDialogView.findViewById(R.id.circularProgressBar);

        horizontalProgressBar.setVisibility(View.GONE);
        circularProgressBar.setVisibility(View.GONE);

        horizontalProgressBar.setProgress(0);
        horizontalProgressBar.setSecondaryProgress(0);
        circularProgressBar.setProgress(0);
        tvShow.setText("");

        //默認配置
        configView();

    }
 
開發者ID:maning0303,項目名稱:MNProgressHUD,代碼行數:41,代碼來源:MProgressBarDialog.java

示例10: createDialogWithView

import android.app.Dialog; //導入方法依賴的package包/類
public Dialog createDialogWithView(View localView) {
    Dialog dialog = new Dialog(getContext(), R.style.jz_style_dialog_progress);
    dialog.setContentView(localView);
    Window window = dialog.getWindow();
    window.addFlags(Window.FEATURE_ACTION_BAR);
    window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
    window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
    window.setLayout(-2, -2);
    WindowManager.LayoutParams localLayoutParams = window.getAttributes();
    localLayoutParams.gravity = Gravity.CENTER;
    window.setAttributes(localLayoutParams);
    return dialog;
}
 
開發者ID:monkeywiiu,項目名稱:Discover,代碼行數:14,代碼來源:JZVideoPlayerStandard.java

示例11: 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

示例12: initProtection

import android.app.Dialog; //導入方法依賴的package包/類
private void initProtection() {

		if(mAuthenticated || !SettingsActivity.isPinEnabled(this)){
			return;
		}
        final Dialog d = new Dialog(this, R.style.Theme_Document_DailogPIN);
        d.setContentView(new PinViewHelper((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE), null, null) {
            public void onEnter(String password) {
                super.onEnter(password);
                if (SettingsActivity.checkPin(DocumentsActivity.this, password)) {
                	mAuthenticated = true;
                	d.dismiss();
                }
                else {
                    showError(R.string.incorrect_pin);
                }
            }

            public void onCancel() {
                super.onCancel();
                finish();
                d.dismiss();
            }
        }.getView(), new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        
        PINDialogFragment pinFragment = new PINDialogFragment();
        pinFragment.setDialog(d);
        pinFragment.setCancelable(false);
        pinFragment.show(getFragmentManager(), "PIN Dialog");
	}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:31,代碼來源:DocumentsActivity.java

示例13: showSigninDialog

import android.app.Dialog; //導入方法依賴的package包/類
public Dialog showSigninDialog() {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(1);
    dialog.setCancelable(true);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
    dialog.setContentView(R.layout.dialog_alert);
    dialog.show();
    ((TextView) dialog.findViewById(R.id.exit)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    return dialog;
}
 
開發者ID:marckregio,項目名稱:maklib,代碼行數:16,代碼來源:DialogView.java

示例14: 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

示例15: showHelp

import android.app.Dialog; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
public static void showHelp(ActivityBase context, View parent, Hook hook) {
	// Build dialog
	Dialog dlgHelp = new Dialog(context);
	dlgHelp.requestWindowFeature(Window.FEATURE_LEFT_ICON);
	dlgHelp.setTitle(R.string.app_name);
	dlgHelp.setContentView(R.layout.helpfunc);
	dlgHelp.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, context.getThemed(R.attr.icon_launcher));
	dlgHelp.setCancelable(true);

	// Set title
	TextView tvTitle = (TextView) dlgHelp.findViewById(R.id.tvTitle);
	tvTitle.setText(hook.getName());

	// Set info
	TextView tvInfo = (TextView) dlgHelp.findViewById(R.id.tvInfo);
	tvInfo.setText(Html.fromHtml(hook.getAnnotation()));
	tvInfo.setMovementMethod(LinkMovementMethod.getInstance());

	// Set permissions
	String[] permissions = hook.getPermissions();
	if (permissions != null && permissions.length > 0)
		if (!permissions[0].equals("")) {
			TextView tvPermissions = (TextView) dlgHelp.findViewById(R.id.tvPermissions);
			tvPermissions.setText(Html.fromHtml(TextUtils.join("<br />", permissions)));
		}

	dlgHelp.show();
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:30,代碼來源:ActivityApp.java


注:本文中的android.app.Dialog.setContentView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。