Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //show the dialog first
- AlertDialog dialog = new AlertDialog.Builder(this)
- .setTitle("Test Dialog")
- .setMessage("This should expand to the full width")
- .show();
- //Grab the window of the dialog, and change the width
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
- Window window = dialog.getWindow();
- lp.copyFrom(window.getAttributes());
- //This makes the dialog take up the full width
- lp.width = WindowManager.LayoutParams.MATCH_PARENT;
- lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
- window.setAttributes(lp);
- import android.support.v7.app.AlertDialog;
- import android.app.AlertDialog;
Add Comment
Please, Sign In to add comment