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


Java Dialog.addContentView方法代码示例

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


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

示例1: showImage

import android.app.Dialog; //导入方法依赖的package包/类
private void showImage(Bitmap bitmap) {
    Dialog builder = new Dialog(this);
    builder.requestWindowFeature(Window.FEATURE_NO_TITLE);
    builder.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

    ImageView imageView = new ImageView(this);
    if (bitmap != null) {
        imageView.setImageBitmap(bitmap);
    } else {
        // fallback image
        imageView.setImageResource(android.R.drawable.ic_delete);
    }
    builder.addContentView(imageView, new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    builder.show();
}
 
开发者ID:yohhoy,项目名称:heifreader,代码行数:18,代码来源:MainActivity.java

示例2: showDialogForView

import android.app.Dialog; //导入方法依赖的package包/类
private void showDialogForView(View view) {
    Dialog dialog = new Dialog(mContext);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.addContentView(view,
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.MATCH_PARENT));
    dialog.show();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:CertificateViewer.java

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

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

示例5: onContextItemSelected

import android.app.Dialog; //导入方法依赖的package包/类
public boolean onContextItemSelected(MenuItem item) {
    KRFAM.log("MainActivity.java > onContextItemSelected");
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    final Account contextAccount = ACCOUNT_LIST_DATA.get(info.position);
    switch (item.getItemId()) {
        case R.id.context_rename: {
            renameAccount(contextAccount);
            break;
        }
        case R.id.context_move: {
            startMove(contextAccount);
            break;
        }
        case R.id.context_delete: {
            deleteAccount(contextAccount);
            break;
        }
        case R.id.context_lock: {
            db.setLock(contextAccount, true);
            getCurrentPage();
            break;
        }
        case R.id.context_unlock: {
            db.setLock(contextAccount, false);
            getCurrentPage();
            break;
        }
        case R.id.context_select: {
            toggleSelect(contextAccount);
            break;
        }
        case R.id.context_delete_folder: {
            deleteFolder(contextAccount);
            break;
        }
        case R.id.context_move_folder: {
            startMove(contextAccount);
            break;
        }
        case R.id.context_rename_folder: {
            renameFolder(contextAccount);
            break;
        }
        case R.id.context_qr: {
            temp_QR = QR_Account(contextAccount);
            if (temp_QR != null) {
                Dialog builder = new Dialog(this);
                builder.requestWindowFeature(Window.FEATURE_NO_TITLE);
                builder.getWindow().setBackgroundDrawable(
                        new ColorDrawable(android.graphics.Color.TRANSPARENT));
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialogInterface) {
                        //nothing;
                    }
                });
                ImageView imageView = new ImageView(this);
                imageView.setImageBitmap(temp_QR);
                builder.addContentView(imageView, new RelativeLayout.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.MATCH_PARENT));
                builder.show();
            }
            temp_QR = null;
            break;
        }
    }
    return true;
}
 
开发者ID:iebb,项目名称:Kasumi,代码行数:70,代码来源:MainActivity.java


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