AlertDialog修改butto顏色
AlertDialog dialog=new AlertDialog.Builder(this, AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
.setTitle("提示")
.setMessage("文本")
.setPositiveButton("確定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
submitQYKPlan();
}
})
.setNegativeButton("取消", null).show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(getResources().getColor(R.color.background));
dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getResources().getColor(R.color.background));
這裏主要是AlertDialog.BUTTON_POSITIVE和 DialogInterface.BUTTON_NEGATIVE起到的作用,分別設置確定和取消的按鈕顏色