当前位置: 首页>>代码示例>>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;未经允许,请勿转载。