If: This is a pop-up dialog by default in the bottom of the window When I click the input box, how to make the top of the dialog dynamic rise of the keyboard, not just the keyboard is blocked?
答案 0 :(得分:0)
AlertDialog.Builder builder = new AlertDialog.Builder(this);
AlertDialog dialog = builder.create();
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
WindowManager.LayoutParams wmlp = dialog.getWindow().getAttributes();
wmlp.gravity = Gravity.TOP | Gravity.LEFT;
wmlp.x = 100; // x位置enter code here
wmlp.y = 100; // y位置
dialog.show();
答案 1 :(得分:0)
您需要设置对话框的x,y位置:
AlertDialog.Builder builder = new AlertDialog.Builder (this);
//set your builder
AlertDialog dialog = builder.Create ();
dialog.Window.Attributes.X = 34;
dialog.Window.Attributes.Y = 17;