2021年3月26日星期五

Codename One container equal width and height

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.

enter image description here

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?

https://stackoverflow.com/questions/66805652/codename-one-container-equal-width-and-height March 26, 2021 at 02:33AM

没有评论:

发表评论