myDialog.show(); Window window = myDialog.getWindow(); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
public void onResume() { super.onResume(); Window window = getDialog().getWindow(); window.setLayout(width, height); window.setGravity(Gravity.CENTER); //TODO: }
Window window = customdialog.getWindow(); window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); window.setGravity(Gravity.CENTER);
public void onResume() { super.onResume(); Window window = getDialog().getWindow(); Point size = new Point(); Display display = window.getWindowManager().getDefaultDisplay(); display.getSize(size); int width = size.x; window.setLayout((int) (width * 0.75), WindowManager.LayoutParams.WRAP_CONTENT); window.setGravity(Gravity.CENTER); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Window window = getDialog().getWindow(); LayoutParams attributes = window.getAttributes(); //must setBackgroundDrawable(TRANSPARENT) in onActivityCreated() window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); if (needFullScreen) { window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } }
private void showPictureialog() { final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); // Setting dialogview Window window = dialog.getWindow(); window.setGravity(Gravity.CENTER); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); dialog.setTitle(null); dialog.setContentView(R.layout.selectpic_dialog); dialog.setCancelable(true); dialog.show(); }
@Override public void onResume() { super.onResume(); Window window = getDialog().getWindow(); window.setLayout(300, 300); window.setGravity(Gravity.CENTER); }
dialog.show(); dialog.setContentView(viewRoot); Window window = dialog.getWindow(); window.setGravity(gravity); window.setLayout(measuredWidth, measuredHeight);
public void onResume() { super.onResume(); Window window = getDialog().getWindow(); window.setLayout(width, height); window.setGravity(Gravity.CENTER); //TODO: }
public void onResume(){ super.onResume(); Window window = getDialog().getWindow(); window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); window.setGravity(Gravity.CENTER); }
Window window = getWindow(); DisplayMetrics metrics = getResources().getDisplayMetrics(); window.setGravity(Gravity.CENTER); int width = (int) (metrics.widthPixels * 1); int height = (int) (metrics.heightPixels * .85); window.setLayout(height, width);
public void onResume() { super.onResume(); super.onResume(); Window window = getDialog().getWindow(); window.setLayout(250, 100); window.setGravity(Gravity.RIGHT); }
@Override public void onStart() { int dialogWidth = 800; int dialogHeight = LayoutParams.WRAP_CONTENT; Window window = getDialog().getWindow(); window.setLayout(dialogWidth, dialogHeight); window.setGravity(Gravity.CENTER); super.onStart(); }
public void onActivityCreated(Bundle savedInstanceState) { Window window = getDialog().getWindow(); LayoutParams attributes = window.getAttributes(); //must setBackgroundDrawable(TRANSPARENT) in onActivityCreated() window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); if (needFullScreen) { window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } }
dialog = new Dialog(this, R.style.AlertDialogTheme); dialog.setContentView(layout); Window window = dialog.getWindow(); window.setLayout( (int)(window.getWindowManager().getDefaultDisplay().getWidth() * .90), (int)(window.getWindowManager().getDefaultDisplay().getHeight() * .90 )); dialog.setCancelable(false);
dialog = new Dialog(activity, android.R.style.Theme_Translucent_NoTitleBar); dialog.setContentView(R.layout.activity_upload_photo_dialog); Window window = dialog.getWindow(); window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); window.setGravity(Gravity.CENTER); //The below code is EXTRA - to dim the parent view by 70% LayoutParams lp = window.getAttributes(); lp.dimAmount = 0.7f; lp.flags = LayoutParams.FLAG_DIM_BEHIND; dialog.getWindow().setAttributes(lp); //Show the dialog dialog.show();
Dialog dialog = super.onCreateDialog(savedInstanceState); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); Window window = dialog.getWindow(); if (window != null) { window.requestFeature(Window.FEATURE_NO_TITLE); window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); } return dialog;
int DisplayWidth, DisplayHeight; Dialog dialog; Display display =((WindowManager)Your_context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); DisplayWidth = display.getWidth(); DisplayHeight = display.getHeight(); dialog = new Dialog(activity_context); // Set your dialog width and height dynamically as per your screen. Window window = dialog.getWindow(); window.setLayout(DisplayWidth , DisplayHeight); window.setGravity(Gravity.CENTER); dialog.show();
Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_friend_data); /*******************dialog features*********************/ final Window window = dialog.getWindow(); window.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); window.setLayout(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT); window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); dialog.show();
public MyCustomDialog(Context context) { super(context, android.R.style.Theme); Window window = getWindow(); window.requestFeature(Window.FEATURE_NO_TITLE); window.setGravity(Gravity.BOTTOM); window.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.empty)); setContentView(R.layout.my_custom_dialog); // actually not necessary as it's already the default value: window.setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); ... }