开发者

Iterating through individual cells of a gridview in android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜