java - Android Eclipse all Spinner fonts became white -


in project, spinner fonts became white reason can't find. before of them black. example, in spinner, dropdown list comes in white. it's xml file follows;

<spinner     android:id="@+id/mainactivity_spinner_city"     android:fontfamily="roboto"     android:layout_width="250dp"     android:layout_height="wrap_content"     android:layout_below="@+id/mainactivity_imageview_logo"     android:layout_margintop="15dp"  /> 

in order make sure, added #000000 related places, list still white. spinner gets populated following method;

arrayadapter<string> dataadapter2 = new arrayadapter<string>(context, android.r.layout.simple_spinner_item, list);     dataadapter2.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);     spinner.setadapter(dataadapter2); 

so added black color simple_spinner_item , simple_spinner_dropdown_item still no change. in java part, not related color. may causing these texts being white?

edit: spinners have problem. can change other elemens' text colors. can't change spinners though inserted textcolor:"#000000" anywhere related spinners.

reason has been found.

while tackling other spinners in other program, realized strange fact caused font becoming white. question looks styling problem, underlying reason application context. in old code, used following code populating spinner;

arrayadapter<string> adapter = new arrayadapter<string>(getapplicationcontext(), android.r.layout.simple_spinner_item, list); 

then changed context parameter follows;

arrayadapter<string> adapter= new arrayadapter<string>(mainactivity.this, android.r.layout.simple_spinner_item, list); 

then undesired white fonts became black!!

if use getapplicationcontext() context parameter, of styling may improper. trying call context directly hardcoded youractivity.this in adapter solve problem.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -