我怎样才能改变按钮(S)的颜色在AlertDialog Android中?
How can I change the color of the button(s) in an AlertDialog in Android?
下面是我做到了。
AlertDialog.Builder customBuilder = new AlertDialog.Builder(new ContextThemeWrapper(this,android.R.style.Theme_Dialog));
customBuilder.setTitle(R.string.popup_error_title);
customBuilder.setNegativeButton("Exit application", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
MyActivity.this.finish();
}
});
AlertDialog dialog = customBuilder.create();
dialog.show();
Button b = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
if(b != null)
b.setBackgroundDrawable(getResources().getDrawable(R.drawable.my_button));
我觉得绘制here
上一篇:安卓:什么是jar文件(LIB或LIBS)的文件夹名称?文件夹、名称、文件、jar
下一篇:java.lang.RuntimeException的:不提供结果ResultInfo {谁= NULL,请求= 1888,结果为0,数据= NULL}到活动结果、数据、RuntimeExceptio