How to right-align Android spinner
You can achieve this completely using the styles. And I think that's the best way. Here is the code from my styles.xml-
<style name="AppTheme.Spinner">
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
</style>
<style name="SpinnerItem">
<item name="android:gravity">right|center_vertical</item>
<item name="android:paddingRight">16dp</item>
</style>
<style name="SpinnerDropDownItem">
<item name="android:gravity">right|center_vertical</item>
<item name="android:paddingRight">16dp</item>
</style>
and here is the implementation to a spinner-
<Spinner
android:id="@+id/type"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@id/title"
android:entries="@array/data"
android:theme="@style/AppTheme.Spinner" />
android.R.layout.simple_spinner_item
refers to the spinner item from the android library and will not have your custom properties. You should be referring to your own layout by using R.layout.simple_spinner_item
.