Android – listview changes the text when an item is clicked

I have a list view built from textviews

If the user clicks the item list, the text of the item will be changed. What should I do?

I know how to add a new item, but change its text? How can I do this?

resolvent:

You can use adapterview.onitemclicklistener to perform this operation. Implement the onItemClick (AdapterView <? > parent, view, int position, long ID) method. The view you pass here is the textview of the item you click, so it should be sufficient

((TextView)view).setText("Hey, I've just been tapped on!");

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>