1

I want to customize Android Spinner's Dropdown background. Not for all spinners used in the application, but only one of them. After doing some research I found this Style in the sdk's styles.xml but I don't know how to inherit it and use it from my Spinner.

<style name="Widget.ListPopupWindow">
    <item name="dropDownSelector">@drawable/list_selector_background</item>
    <item name="popupBackground">@drawable/spinner_dropdown_background</item>
    <item name="dropDownVerticalOffset">-10dip</item>
    <item name="dropDownHorizontalOffset">0dip</item>
    <item name="dropDownWidth">wrap_content</item>
</style>

Specifically I want to get ride of the default theme's borders (arrows in red) and use the full width.

enter image description here Thanks in advance

Nabin
  • 11,216
  • 8
  • 63
  • 98
Antonio Jose
  • 2,778
  • 3
  • 21
  • 26
  • use `Custom Adapter` and change the background of your textview . – Rustam Oct 24 '14 at 06:23
  • why not you trying this with a sliding drawer make SpinnerItem one as textview and on click of that shows sliding drawer with the following entry you have – Hasnain Oct 24 '14 at 06:48
  • Maybe I wasn't enough clear. I want to change the border of the ListPopupWindow used internally by PopupWindow when opened as DropDown. – Antonio Jose Oct 24 '14 at 08:48

1 Answers1

0

You can use PopupMenu:

PopupMenu popup = new PopupMenu(this, someButton);
popup.getMenuInflater().inflate(R.menu.your_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
// switch your menu item and do something..
return true;
}
});
popup.show();

After that you can customize you menu items: Android custom option menu item

Community
  • 1
  • 1
QArea
  • 4,955
  • 1
  • 12
  • 22