本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}