Android Preferences Dialog Style

I am trying to combine dialogs in my application. All actions are expanding AppCompatActivity, so the dialogs are significant, except DialogPreferencein my settings.

I used PreferenceActivity, but I also changed it to AppCompatActivityusing PreferenceFragment. It didn’t matter.

So, I tried to add my own style to my settings. Theme, like this

<style name="SettingsTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:dialogPreferenceStyle">@style/StyledDialog</item>
</style>

<style name="StyledDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
</style>

but all i got is (i also tried alertDialogStyle, alertDialogTheme and dialogTheme), the holo dialog stays in place

enter image description here

Another thing I tried was expanding EditTextPreferenceand overriding onPrepareDialogBuilderwith forcing my theme:

@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
    super.onPrepareDialogBuilder(builder);

    builder.getContext().setTheme(R.style.StyledDialog);
}

. , AppCompat, ? , , , Android.

: , DialogPreference android.app.AlertDialog android.support.v7.app.AlertDialog. , Builder DialogPreference.

2: , DialogPreference, com.android.support:preference-v7:23.1.0 . , , . , , :

+4

Source: https://habr.com/ru/post/1617067/


All Articles