Skip to content Skip to sidebar Skip to footer

Dropdown Spinner Alignment

I develop an Adroid application. So i want to customize programmatically the behavior of DropDown Spinner. I overwrite the getDropDownView method but i cannot find anything to chan

Solution 1:

The alignment/horizontal offset of a spinner dropdown (which is a PopUp) is controlled by the value of the left padding of the spinner itself.

Therefore setting the left padding of a spinner to 0dp or between 0dp - 2dp should correct the left alignment, then setting a proper dropdown width with the .setDropDownWidth method of the spinner should correct the the right alignment.

To get a proper dropdown width, get the layout parameters of the spinner, and pass its width property to the .setDropDownWidth method of the spinner, you might have to make some little adjustment on this value to get the required alignment.

Solution 2:

I wait for someone to help me. Not happened. So i found a workaround. I use a TextView and on click a ListView is displayed. So if someone find a better approach, please let me know

Post a Comment for "Dropdown Spinner Alignment"