android - Unable to change text color of ListFragment items -
i have listfragment populated cursor. have list background set white, , reason text set white. i've tried changing textcolor attribute in layout xml, doesn't seem have effect. can point out i'm missing? thanks.
from listfragment:
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string[] = {dbconstants.col_family_name}; int[] = {android.r.id.text1}; getloadermanager().initloader(family_loader, null, this); adapter = new simplecursoradapter(getactivity().getapplicationcontext(), r.layout.simple_spinner_drop_down_view, null, from, to, cursoradapter.flag_register_content_observer); setlistadapter(adapter); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); registerforcontextmenu(getlistview()); getlistview().setbackgroundresource(android.r.color.white); getlistview().setcachecolorhint(android.r.color.transparent); }
the list item layout:
<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinneritemtext" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="15dip" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#000000" />
i suspect text isn't white, isn't showing because you're binding wrong textview. think need change line:
int[] = {android.r.id.text1};
to this:
int[] = {r.id.spinneritemtext};
Comments
Post a Comment