I had created an AlertDialog
and wanted to change the title color of AlertDialog but getting failed in every attempt. It works very fine on Android 5.0
and above with title color as black but when it runs below Android 5.0, it's title color get's changed to white, i had used style and many other sources from internet but failed, my code is as follows,
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(msg)
.setCancelable(true)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
final AppCompatDialog dialog = builder.create();
dialog.setTitle("VALIDATION_TITLE error");
dialog.setCancelable(false);
dialog.show();
My issue get's solved by following line,
dialog.setTitle( Html.fromHtml("<font color='#FF7F27'>Set IP Address</font>"))
but i don't want to use this, anyhelp would be greatly appreciated. You can see the screenshot of my dialog from this chat link