gpt4 book ai didi

android - GridLayout 与 TableLayout

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:05:26 24 4
gpt4 key购买 nike

我不确定它们两者之间的区别是什么以及我应该将哪个用于我的目的?

我想做的是创建一个带有文本输入的自定义虚拟小键盘,它可以动态更改其内容以具有日期选择器。

所以我需要一个布局系统,它支持其中的许多不同大小的单元格。

哪个更符合我的需求,有什么区别?

最佳答案

根据我的经验,GridLayoutTableLayout 都给我相同的结果。他们似乎都拉伸(stretch)列以适应最宽的子元素。两者都不会在单元格周围提供网格线或边框。

来自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.

来自 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.

所以在我看来,GridLayout 更通用一些,可能正是您正在寻找的。

关于android - GridLayout 与 TableLayout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16300540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com