Sud*_*dar 4 android android-alertdialog
我在我的Android应用程序中重用了一个AlertDialog框.
我在onCreateDialog()方法和onPrepareDialog()方法中创建一个对话框,我尝试使用以下代码更改positiveButton的文本.
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, this.getString(R.string.add), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Handler code
}
}
Run Code Online (Sandbox Code Playgroud)
onclick侦听器正在更改,但按钮文本未更改.
它是Android中的错误还是我做错了什么?
小智 22
一种解决方案就是强制按钮重绘.例如,取消冗长操作的按钮可能在完成时变为"OK",例如
Button button = progressDialog.getButton(ProgressDialog.BUTTON1);
button.setText("OK");
button.invalidate();
| 归档时间: |
|
| 查看次数: |
10786 次 |
| 最近记录: |