Skip to content

Tag: spinner

How to center simple_spinner_dropdown_item in Android Studio?

I want to center the text of my simple_spinner_dropdown_item element, so I got this solution: However, this is just working for the simple_spinner_item where all the dropdown items are way to tight. But when ever I replace it by simple_spinner_dropdown_item the centering is no longer working. I guess the answer lies in this line, but I dont know how to

How do you get the selected value of a Spinner?

I am trying to get the selected items string out of a Spinner. So far I have gotten this: This does not work and gives a class casting exception (I thought I could cast a View to a widget that inherits it. Obviously not!) So how do you get the selected value of a Spinner? Answer To get the selected