nileshjaihind
nileshjaihind

Reputation: 1

Spinner Text Not Visible

I am trying to setText in Spinner but is not visible in device. (Visible in emulater) .

Please give solution for this.

Upvotes: 0

Views: 2009

Answers (2)

Edward van Raak
Edward van Raak

Reputation: 4910

You gave the text a holo color that is only available on a high API level and your device doesn't know what to do with it so it gave the default color of text which is black, which just happens to be the color of the background in your spinner. Yes this is a wild guess.

Upvotes: 0

Surbhi
Surbhi

Reputation: 4078

You cant settext to spinner with settext(). You have to use ArrayAdapter for displaying the content in spinner. like this,

Declare an array-

String[] type_array = {"Monthly","Quaterly","Yearly"};

In onCreate()-

spinner_type = (Spinner) findViewById(R.id.spinner_type_susa);
spinner_type.setOnItemSelectedListener(this);

ArrayAdapter<String> adapter_type = new ArrayAdapter<String>(this,R.layout.spinner_row,type_array);
adapter_type.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_type.setAdapter(adapter_type);

Upvotes: 1

Related Questions