如何更改單選按鈕的顏色?下圖顯示默認情況下單選按鈕是藍色的,但我想改變它。如何更改單選警報對話框的顏色?
我的代碼是:
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
alertDialogBuilder.setCustomTitle(promptsView);
alertDialogBuilder.setItems(frequencyName, null);
// alertDialogBuilder.setTitle("SELECT FREQUENCY");
alertDialogBuilder.setSingleChoiceItems(frequencyName, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
selectedFre = frequencyName[i];
}
});
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
txtFrequency.setText(selectedFre);
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
重複的:http://stackoverflow.com/questions/23255776/android-alert-dialog-replace-default-blue-with-another-color –
Thanks..can你告訴我什麼是參數他們正在傳遞這個方法res.getIdentifier(「titleDivider」,「id」,「android」); –
請看:https://developer.android.com/reference/android/content/res/Resources.html#getIdentifier(java.lang.String,java.lang.String,java.lang.String)。基本上這是說:從包「安卓」 –