开发者

Iterating through individual cells of a gridview in android

开发者 https://www.devze.com 2023-03-13 19:32 出处:网络
I am having a gridview, each cell of which contains a textview. I want to change the text of individual textviews in the gridview on click of a button. Once the text of a particular textview has been

I am having a gridview, each cell of which contains a textview. I want to change the text of individual textviews in the gridview on click of a button. Once the text of a particular textview has been changed, i want to move to next cell in the grid开发者_开发百科view. Please help me to do this.


set this property to your textview android:nextFocusRight in xml


well your list view has an adapter. to populate your adapter you are using some sort of an array( of strings, objects etc..) so you need a variable that will track the position of the view in the grid starting from 0 and incrementing with each button click. on the button click before you increment the position you need to change the text of the items array for the adapter on the relevant position and call notifyDataSetChanged() on your adapter. that's it.

0

精彩评论

暂无评论...
验证码 换一张
取 消