Как изменить цвет текста в AlertDialog

18 Мар 2023г. в 13:50

Проблема когда включена темная тема кнопки не видно (нужно чтобы они были белые)

Override
public void onBackPressed() {
new AlertDialog.Builder(this)
.setTitle("Обновить или выйти?")
.setNeutralButton("Обновить" , new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {

recreate();
}
})
.setPositiveButton("Выйти", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface arg0, int arg1)
{
finishAndRemoveTask();
}
}).create().show();
}
Проверяю темную тему так

if (currentNightMode==UI_MODE_NIGHT_YES) {}
else
{}


Оставить комментарий

Ваше имя::


Комментарий::




(2023-03-18 13:50:33)
Заменил
new AlertDialog.Builder(this)
на new AlertDialog.Builder(this,R.style.AlertTheme)

<style name="AlertTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:background">#ffffff</item>
<item name="android:textColor">#212121</item>
<item name="android:textColorPrimary">#212121</item>
Результат устроил