barq
barq

Reputation: 3711

Custom Spinner dropdown not working

I have a custom simple_spinner_item and simpel_spinner_dropdown_item. I am setting these using the following code:

adapter = new ArrayAdapter<Integer>(context, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

However, the custom style is not applied. How can I fix this?

I am overriding the default android dropdown items in my style.

However, it works if I create a new Adapter that extends ArrayAdapter and override getDropdownResource.

Upvotes: 0

Views: 1076

Answers (3)

Willey Hute
Willey Hute

Reputation: 1088

This might help. Setting parent theme worked for me. for separate item and dropdown file. https://stackoverflow.com/a/17213328/7735068

Upvotes: 0

Surender Kumar
Surender Kumar

Reputation: 1123

Instead of android.R.files you have to include your project R.files for custom layout.

Upvotes: 0

Jonas
Jonas

Reputation: 88

Try to remove "android" like this :

adapter = new ArrayAdapter<Integer>(context, R.layout.simple_spinner_item);
adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);

Upvotes: 1

Related Questions