How do you exchange the indices of two children in a ViewGroup?
How do I use setLeft
on a child view? It doesn't seem to be defined for objects of class View
.
Edit.
Answer to #2 is that setLeft
is only available from API11. Ditto setX
.
You can remove all children and than add by required order. I'm not found another way.
IMHO the best way for reorganize layout is use RelativeLayout.
As I do this:
// prepare rules
lpTopLeft = new RelativeLayout.LayoutParams(minDimension/5, minDimension/5);
lpTopLeft.setMargins(minDimension/50, minDimension/50, minDimension/50, minDimension/50);
lpTopLeft.addRule(RelativeLayout.ALIGN_PARENT_TOP);
lpTopLeft.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
And now use prepared settings:
// rearrange child
bnReset.setLayoutParams(lpTopLeft);