Reputation: 2115
I have GridLayout 7x7, is it possible to change content only of cell (3,4) and I want to do it dynamically. Example: I have 7x7 grid of buttons and want to change button on position (3,4) to TextView.
EDIT: Also, is it possible to set zero padding around child?
Thanks!
Upvotes: 0
Views: 1454
Reputation: 195
In GridView you cant access elements specific by coordinates (3,4). The elements are numbered like in 2D arrays. So your (3,4) element will have (7*3+4)-1 index. And you can access it by.
ViewGroup gridChild = (ViewGroup) mGridView.getChildAt(24);
EDIT: Set padding to zero.
gridChild.setPadding(0,0,0,0);
Upvotes: 1