CodePudding user response:
Adapter has a notifyDataSetChanged () method, and this way also is not very good ah, you can open a adapter set colors method,CodePudding user response:
Adapter variables defined in the state, defining methodsPublic void setState (int state) {
This. State=state
}
Item in getView assignment
If (state==1) {
TextView Settings to change the color of the
} else {
Initial color sets the default}
The button click add
{
If (adapter!=null) {
Adapter. SetState (1);
Adapter. NotifyDataSetChanged (); }
}
CodePudding user response:
Better control on the data source with a font color of the state through the notifyDataSetChanged update the font color of the item, but you can also through the for (I==0, iTV. SetTextColor (color)
}