Intro:
With the new release of Android 6.0.1, seems like Android made some changes on the Spinner component because by default, the inner padding ar
I had the same issue and my plan was to rollback the 6.0.1 update for v23 only.
Spinner
has a style attached to it. For example style named as Widget.Spinner
in example below:
styles.xml
under values-v23
directory (for changes will be applied to API v23 only). For example, see Widget.Spinner
style definition example below:
The style's parent is Widget.AppCompat.Spinner
and it redefines it's android:background
with the one we will be rolling back from 6.0.1 source.
Note, that if you're targeting other versions too, you will need to add a default styles.xml
under values
directory with entry
for it is easier to define another generic style rather than different layout xml files and your project should have a generic styles.xml
under values
directory anyway, right? :)
spinner_background_material.xml
from https://android.googlesource.com/platform/frameworks/base.git/+/android-6.0.1_r3/core/res/res/drawable/. Save it under drawable-v23
for again, we will just make sure we're changing API v23 only.File's default content is:
Now, this is the file you might want to tweak. I made changes to this file for tweaking the caret position:
a) set layer-list
's android:paddingEnd
equal to 0dp
b) halved first item's android:width
to 24dp
c) removed the second item's android:end
attribute
The changes made background thinner, by stripping it's sides but the approach retained the ripple effects. Feel free to play around with your own custom values, if needed.
Download into drawable-v23
(see link above):
a) control_background_40dp_material.xml
b) ic_spinner_caret.xml
Download into color-v23
:
a) control_highlight_material.xml
from https://android.googlesource.com/platform/frameworks/base.git/+/android-6.0.1_r3/core/res/res/color/ (this file can probably reside under drawable-v23
too, but lets follow the pattern of original source locations for now). Note, that file's @dimen/highlight_alpha_material_colored
is picked up from appcompat-v7
, if you use one :) If not, you can reffer it's value from it:
- 0.26
The solution is not the best as you need to bring over files you don't originally own. Also, you might want to monitor the possible updates to v23 for any future changes. But at least the changes are contained to v23 only.