Swe*_*per 3 java android dialog android-layout
我有一个EditText对象:
EditText textbox = new EditText (this);
textbox.setHint (something);
Run Code Online (Sandbox Code Playgroud)
我想将此视图添加到AlertDialog使用构建器的视图中。
AlertDialog.Builder builder = new AlertDialog.Builder (this);
builder.setTitle (R.string.enter_password_name)
.setPositiveButton (R.string.save_text, new DialogInterface.OnClickListener () {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton (R.string.cancel_text, new DialogInterface.OnClickListener () {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
Run Code Online (Sandbox Code Playgroud)
我知道有一种方法,setView(int)但我使用的是 API 15,所以我只能使用setView(View),这也是我通过代码创建视图的原因。
到目前为止一切顺利,但我现在需要设置LayoutParams视图的。我LayoutParams应该选择什么?我知道在 a 中RelativeLayout使用 a RelativeLayout.LayoutParams,在 a 中LinearLayout使用 a LinearLayout.LayoutParams。但是我应该在对话框中使用什么?
| 归档时间: |
|
| 查看次数: |
1509 次 |
| 最近记录: |