Align Text in Center - Spinner

Simply add in your default app theme style this two lines :

<item name="android:spinnerItemStyle">@style/spinnerItemStyle</item>
<item name="android:spinnerDropDownItemStyle">
   @style/spinnerDropDownItemStyle
</item>

create the new style :

<style name="spinnerItemStyle">
    <item name="android:gravity">center</item>
</style>

<style name="spinnerDropDownItemStyle">
    <item name="android:gravity">center</item>
</style>

Thats it !

Note that the base theme used here is : Theme.AppCompat.Light and this will be applied as the default spinner styles in your app.


Use following tag on spinner

android:textAlignment="center"

Tags:

Xml

Android