I have a spinner like the image below;
How can I remove the gap on the left x between the spinner and its dropdown - preferably a solution that works on API8 as I am trying to keep my app requirements as low as possible.
I had assumed this would be layout_margin in the spinners style, but after reading this question it seems thats not possible.
In my theme I have;
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:dropDownListViewStyle">@style/DropDownStyle</item>
<item name="android:dropDownSelector">@style/DropDownStyle</item>
</style>
<style name="DropDownTopStyle">
<item name="android:clickable">true</item>
<item name="android:background">@drawable/dropdowntop</item>
</style>
<style name="DropDownStyle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:layout_margin">0dp</item>
<item name="android:clickable">true</item>
<item name="android:background">@drawable/dropdownback</item>
<item name="android:popupBackground">@drawable/dropdownback</item>
<item name="android:cacheColorHint">#FFF000</item>
</style>
Thanks, Thomas
Additional; I can see there might be a way to make a popup myself in code - if this is necessary, can I somehow get to the adapters popup view? (that is the list that it displays). Trying to recreate the whole adapters behavior from scratch seems a terrible way to go - but if I can get to that view and disable the normal popup behavior, then I could make my own popup without the annoying offset.
Seems you need to extend the Spinner View to make your own AlertDialog that shows the list of items, or in newer version (API 16+) you can use
android:dropDownHorizontalOffset="-8dp"
check the full details here: How to change the position of opened spinner?