So I have several android.widget.Spinner
for which I have set the android:spinnerMode="dialog"
For the resulting dialog windows I would like the title (set with android:prompt="Good Title"
) to be centered horizontally (but it keeps being placed at the start :S ).
I have tried the following to no avail (all my activities use my BaseTheme.DefaulTheme
which ultimately inherits Theme.AppCompat.NoActionBar
):
<style name="BaseTheme.DefaultTheme">
<item name="android:alertDialogTheme">@style/CustomAlertDialogTheme</item>
<item name="android:spinnerStyle">@style/CustomSpinnerStyle</item>
</style>
<style name="CustomAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:windowMinWidthMajor">40%</item>
<item name="android:windowMinWidthMinor">40%</item>
<item name="android:windowTitleStyle">@style/DialogTitle</item>
</style>
<style name="DialogTitle">
<item name="android:gravity">center_horizontal</item>
<item name="android:textAlignment">center</item>
<item name="android:layout_centerHorizontal">true</item>
</style>
<style name="CustomSpinnerStyle" parent="Widget.AppCompat.Spinner">
<item name="android:gravity">center_horizontal</item>
<item name="android:dialogTitle">@style/DialogTitle</item>
</style>
My targetSdkVersion is 24 and minSdkVersion is 19.