I have an Android project that uses several containers inside a Grid Layout.
The containers' height and width are different and I am looking for a way to make them square.
I have tried it the following way:
int w = container.getWidth();
container.setHeight (w);
This does not not work, because:
a) container.setHeight(i)
does not change the height of the container, and
b) container.getWidth()
returns 0.
What would be the best approach to obtain square containers?
EDIT
Here is a updated screenshot: left is before, right is after using the code sample.