GridLayout vs TableLayout

ぃ、小莉子 提交于 2019-12-04 03:36:40

In my experience I had both GridLayout and TableLayout give me the same results. They both seem to stretch the columns to fit the widest child element. Neither will give you gird lines or borders around the cells.

From the official docs on GridLayout:

Row and Column Specs Children occupy one or more contiguous cells, as defined by their rowSpec and columnSpec layout parameters. Each spec defines the set of rows or columns that are to be occupied; and how children should be aligned within the resulting group of cells. Although cells do not normally overlap in a GridLayout, GridLayout does not prevent children being defined to occupy the same cell or group of cells. In this case however, there is no guarantee that children will not themselves overlap after the layout operation completes.

and from the TableLayout:

The table has as many columns as the row with the most cells. A table can leave cells empty. Cells can span columns, as they can in HTML.

So it seems to me that the GridLayout is a bit more versatile and probably what you are looking for.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!