android - Text on spinner is white on a white background -
the text on spinners white, , have no idea why.

this xml, nothing special
<spinner android:id="@+id/spinner_date" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> and code
datespinner = (spinner) findviewbyid(r.id.spinner_date); selecteddate = calendar.gettime(); list<string> list = new arraylist<string>(); list.add(formatter.format(selecteddate)); dateadapter = new arrayadapter<string>(mcontext, android.r.layout.simple_spinner_item, list); datespinner.setadapter(dateadapter); what reason text displayed in white?
edit: i've found reason, replaced mcontext parameter set in oncreate.
mcontext = getapplicationcontext(); now use d
ateadapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, list); and works.
i have same problem , have found answer. dont use application context, instead, use getactivity() (if in fragment) or (if in activity), work
dateadapter = new arrayadapter<string>(**this**, android.r.layout.simple_spinner_item, list);
Comments
Post a Comment