我正在寻找一种方法来调整位于AlertDialog中的EditText的大小(以便它不会触及边缘)。
我的示例代码
AlertDialog.Builder alert = new AlertDialog.Builder(myActivity.this);
alert.setTitle("Test");
EditText textBox = new EditText(myActivity.this);
alert.setView(textBox);
alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// do nothing
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// do nothing
}
});
alert.show();
我尝试了这里提供的解决方案,但都没有成功: