I'm unable to resize and reposition the alert dialog box. Ple开发者_如何学JAVAase help me do this!
I think not possible since the api does not support it.
You should write your own class that extends the dialog or create an activity and use android:theme="@android:style/Theme.Dialog to make it look like a dialog. Then you can use standard techniques for placing widgets.
I just tried, Now, I can reposition the AlertDialog, but I can not resize it.
Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Sample Title");
AlertDialog d = builder.create();
Window win = d.getWindow();
WindowManager.LayoutParams lp = win.getAttributes();
lp.y = 100;
lp.width = 320; //It does not work.
win.setAttributes(lp);
d.show();
精彩评论