Android TableLayout 还是 GridView?

发布于 2024-10-31 07:59:22 字数 145 浏览 1 评论 0原文

我想创建一个大约三宽八深的单词网格。我希望能够选择一些单词并对其进行淡入淡出动画。我还想知道什么时候选择了一个词。我一直在研究 TableLayout 和 GridView 来做到这一点。其中一个会比另一个更好吗?其中一个比另一个更能适应 Android 中的不同屏幕尺寸吗?

I want to create a grid of words approximately three wide and eight deep. I would like to be able to select some of the words and do a fade animation on them. I would also like to know when a word has been selected. I have been looking at TableLayout and GridView to do this. Would one of these be better than the other to do this? Is one of them more adaptable to the different screen sizes in Android than the other?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

总以为 2024-11-07 07:59:22

我已经玩了一下tablelayout(和tablerow),它肯定会成功,我想更重要的是问题是你是否期望有固定数量的列(“大约”没有帮助.. .)。如果是这样,并且您可以很好地控制表格/网格中的内容,那么表格布局很可能就是您正在寻找的(我只是发现它更简单,但也许我错了)。

它们都可以通过正确的布局指令适应屏幕尺寸,并且正确的编程将为您提供类似的结果。

但是,如果你允许屏幕旋转,你可能想使用gridview

参数,参数,参数......

I've played around a bit with tablelayout (and tablerow) and it will definitely do the trick, I guess more importantly the question is whether you expect to have a fixed number of columns or not ("approximately" doesn't help...). If so and you have very good control of what goes in the table/grid, tablelayout may very well be what you're looking for (I just find it simpler, but maybe I'm wrong).

They both can adapt to screen size with the right layout instructions, and proper programming will give you similar results.

But then, if you allow the screen to rotate, you may want to use gridview

parameters, parameters, parameters...

﹏雨一样淡蓝的深情 2024-11-07 07:59:22

我认为 TableLayout 会更容易使用。对于 GridLayout,您需要构建自定义适配器,这会导致应用程序更加复杂。

考虑到不同的场景尺寸,GridLayout会根据内容自行选择合适的列数和行数,并且在添加项目时会更加灵活。

此外,GridLayout 将会更加灵活,但还需要做更多的工作。

I think a TableLayout would be more easy to use. For a GridLayout you need to build custom adapters and so one which result in a more complicated application.

Looking at different sceensizes, a GridLayout will choose a good number of columns and rows by itself according to the content and it will be more flexible with adding items.

Also the GridLayout will be more flexible but it is some more work to make.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文