网格布局VS TableLayout [英] GridLayout vs TableLayout

查看:586
本文介绍了网格布局VS TableLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能确定什么他们两个之间的区别是,哪些我应该用我的效果影响不大?

I'm unsure as to what the differences between the two of them are and which I should use for my purpouses?

我试图做的是创建一个自定义的虚拟数字键盘的文字输入,并可以动态地改变它的内容有一个日期选择器。

What I'm trying to do is create a custom virtual numpad with text inputs and that can dynamically change its contents to have a date picker.

所以我需要一个布局系统,它支持许多不同大小的细胞里面。

So I need a layout system which supports many different sized cells inside it.

哪个更适合我的需要和有什么区别?

Which better suits my needs and what's the difference?

推荐答案

在我的经验,我有两个网​​格布局 TableLayout 给我相同的结果。他们似乎都伸展列,使其符合最宽的子元素。也不会给你束腰周围的细胞系或边界。

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.

从官方文档网​​格布局

行和列规格   儿童占用一个或多个连续的细胞,通过rowSpec和columnSpec布局参数的定义。每个规范定义了一组行或要被占用的列;如何孩子应该得到的细胞群内对齐。虽然细胞不正常在GridLayout重叠,GridLayout的不prevent儿童被定义为占据细胞相同的细胞或组。然而,在这种情况下,不能保证孩子不会自己重叠的布局操作完成后。

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

表有许多列,与大多数细胞的行。一个表可以离开细胞空白。细胞可以跨列,因为它们可以在HTML中。

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.

这篇关于网格布局VS TableLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆