Requirements, in the ListView when the cursor is in an item, the text color in this item changes
Code:
Audioondemandadapter adapter = new Audioondemandadapter (this, ListView);
Bring the ListView into the adapter
The GetView method in adapter
if (listview.getselecteditemposition () = = position) {holder.tv_film_item.setTextSize (35);} Else{holder.tv_film_item.settextsize (30);}
Judging position in the adapter
When item in the ListView changes
Listview.setonitemselectedlistener (New Onitemselectedlistener () {@Overridepublic void onitemselected (Adapterview <?> Parent, view view, int position, long id) {radiolistadapter.notifydatasetchanged ();} @Overridepublic void onnothingselected (adapterview<?> parent) {}});
Each time you change the item, the adapter will be updated, and the method in the GetView will be recalculated. That's the function.
Now I can't find a way to use notifydatasetchanged.
Android ListView selected text color change