4

I have a custom theme created with this generator. It has a custom style for Spinners which I don't like. I want to change the background drawable but I can't seem to figure out which property controls this.

This is what the themed version looks like

enter image description here

And here is what it will look like when using the Holo.Light theme.

enter image description here

Notice the dark gray lines around the dropdown list in the first (themed) image. This is what I want to get rid of. What property controls this? I want them to match the default.

Also, what controls the vertical aligment of the dropdown list? As you can see, it is overlapping with the Spinner in the first image (the line under it isn't visible as it is in the second image).

1
  • @user2558882 Here's one more question related to my earlier problem.
    – MikkoP
    Dec 6, 2013 at 12:23

4 Answers 4

9

The attribute you want is android:popupBackground on the Spinner element.

If you look closely, the holo popup also overlaps the spinner some, but there is a bunch of padding for the drop shadow, so it looks good.

However, you can use android:dropDownVerticalOffset on the Spinner element to adjust it.

4
  • Thanks! I'm not sure what I should set as the popupBackground property. What is the default for Android's Holo.Light? I checked it from Android's sources and it seems like @android:drawable/spinner_dropdown_background`. This doesn't change the look though.
    – MikkoP
    Dec 6, 2013 at 14:42
  • 1
    Not sure...I tried downloading a theme from that site you used, but I wasn't sure where it was actually modifying the dropdown background drawable. In your case, it would be make the most sense to remove the part of the theme that changes that, rather than overriding it in the layouts multiple times. You may need to experiment with modifying it.
    – Tenfour04
    Dec 8, 2013 at 21:11
  • Anyway, if you're supporting pre-Honeycomb as well, you probably want to flat out clone the drawables from the latest Jellybean rather than try to reference the built-in @android drawable. You can copy sdk\platforms\android-19\data\res\drawable\spinner_dropdown_background.xml and the various drawables it references in drawable-hdpi and drawable-xhdpi.
    – Tenfour04
    Dec 8, 2013 at 21:14
  • Thanks a lot bro!. You save me a lot of time trying to redo a whole view's layout.. ++1
    – KinGPinG
    Nov 14, 2014 at 21:10
1

We came across the same issue. It has to do with the Android Holo theme generator.

Here are the lines that you should remove from your Theme.xml file...

<item name="android:spinnerStyle">@style/SpinnerCustom</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItemCustom</item>
<item name="android:popupMenuStyle">@style/PopupMenu.Custom</item>
<item name="android:dropDownListViewStyle">@style/DropDownListView.Custom</item>
<item name="android:actionDropDownStyle">@style/DropDownNav.Custom</item>

...by removing these, we now have the standard Holo.Light theme on the spinner dropdowns.

0

You need to change the parent of spinnertheme to android:Widget.Holo.Light.Spinner

<style name="SpinnerTHEME" parent="android:Widget.Holo.Light.Spinner">
0
0
<style name="spinner_style" parent="android:Widget.Holo.Light.Spinner">
       <item name="android:paddingLeft">@dimen/ten_dp</item>
       <item name="android:paddingRight">@dimen/ten_dp</item>
</style>
1
  • 5
    A good answer will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO. Please add some description to make others understand. :) Sep 15, 2017 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.