I am trying to achieve a vertical Spinner. I am able to rotate the spinner view using
spinner.setRotation(-90);
But this rotates only spinner view but not the dropdown list. As shown in the below image. How to rotate dropdown window also?

After trying below answer I am getting into this problem

You will need to create a custom adapter for your spinner.
Next on your getView make sure you rotate the parent that get's passed to it.
An example adapter:
public class AdapterTest extends ArrayAdapter<String> {
public AdapterTest(Context context, int resource, List<String> objects) {
super(context, resource, objects);
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = LayoutInflater.from(getContext()).inflate(R.layout.row_spinner, parent, false);
if (parent.getRotation() == 0 && parent instanceof ListView) {
parent.setRotation(-90);
}
return v;
}
}
Result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With