Change color of Textview in Listview
I'm very new to Android and I wanna change the textcolor of a TextView in
a Listview. When trying this, the color won't change. Who can help me with
this (simple?) problem?
I use the following code in my "BaseAdapter" to control the ListView:
public View getView(int i, View view, ViewGroup viewGroup) {
if (view == null) {
view = mInflater.inflate(R.layout.cijfer_listitem, null);
holder = new ViewHolder();
holder.mCijferTxt = (TextView) view.findViewById(R.id.cijferTxt);
holder.mVakTxt = (TextView) view.findViewById(R.id.vakTxt);
holder.mVakUitgebreidTxt = (TextView)
view.findViewById(R.id.vakUitgebreidTxt);
holder.mIdTxt = (TextView) view.findViewById(R.id.idTxt);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
Cijfer cijfer = mCijfers.get(i);
holder.mCijferTxt.setText(cijfer.getCijfer());
holder.mVakTxt.setText(cijfer.getCursus());
holder.mVakUitgebreidTxt.setText(cijfer.getCursusUitgebreid());
holder.mIdTxt.setText("" + cijfer.getCijferID());
if (cijfer.isDef() == true ){
holder.mCijferTxt.setTextColor(R.color.colorTxtDef);
}
else{
holder.mCijferTxt.setTextColor((R.color.colorTxtConcept));
}
return view;
}
public class ViewHolder {
public TextView mCijferTxt;
public TextView mVakTxt;
public TextView mVakUitgebreidTxt;
public TextView mIdTxt;
}
I wanna change the color of the TextView "cijferTxt".
Hope this is enough info for you to help me :)
No comments:
Post a Comment