网格布局比。表布局 [英] Grid Layout Vs. Table Layout

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

问题描述

我的工作就像一个航空公司订票系统预订引擎的Andr​​oid应用程序。若要获取的说所有的特定乘客搜索可用航空公司的内容,结果将显示在手机屏幕上。

I am working on a booking engine android app like an airline booking system. To fetch the content of say all the available airlines specific to a passenger search, this is then displayed on the mobile's screen.

哪一个,表格布局或网格布局,将是有效的考虑画面的加载时间,消耗的系统内存和附加功能?

Which one, a table layout or a grid layout, will be effective considering screen loading time, system memory consumption, and additional features?

推荐答案

还有就是Android的API中没有网格布局,所以我建议不要使用。 :)

There is no GridLayout in the Android API, so I would suggest not using that. :)

(注:由于API级别14,还有最后一个GridLayout的布局管理器;请参阅下面的答案然而,GridView控件这个答案的描述仍然是准确和很好的说明。)

如果你的意思是GridView控件,TableLayout和GridView是的完全的不同的东西。

If you mean GridView, TableLayout and GridView are completely different things.

一个GridView控件基本上像一个ListView,但其项目被安排在一个严格的网格。它连接到一个适配器,和检索来自适配器次通过它在用户滚动。网格中的所有元素的必须的是相同的大小。用户可以通过每一个项目移动一个可见选择器 - 一个的GridLayout的目标是从一个适配器的显示数据,并让用户导航和选择每个所显示的项目。从一个ListView唯一的区别是,物品被置于网格中在垂直列表,而不是

A GridView is basically like a ListView but whose items are arranged in a strict grid. It is attached to an Adapter, and retrieves views from the Adapter has the user scrolls through it. All elements in the grid must be the same size. The user can move a visible selector through each item -- the goal of a GridLayout is to display the data from an Adapter and let the user navigate and select each of the displayed items. The only difference from a ListView is that the items are put in a grid instead of in a vertical list.

TableLayout只是一个布局管理器,有点像HTML中的表。它本身并不做任何滚动;有这种滚动,你必须把TableLayout的滚动型的东西。这意味着所有正在显示必须填充到TableLayout前期,所以滚动型数据知道的全部空间是在滚动。它也不会直接给你per-项选择或相互作用,因为一个TableLayout不具备的项目,它仅仅是一个布局管理器。

TableLayout is just a layout manager, somewhat like a table in HTML. It does not itself do any scrolling; to have something that scrolls you must put the TableLayout in a ScrollView. This implies that all of the data you are displaying must be populated into the TableLayout up-front, so the ScrollView knows the total space it is to scroll in. It also does not directly give you per-"item" selection or interaction, because a TableLayout doesn't have items, it is just a layout manager.

您实际上并没有足够近的有用信息提供有关你实际上是试图做的人建议使用什么什么。这在很大程度上取决于你想要什么特别。

You didn't actually give near enough useful information about what you are actually trying to do for anyone to recommend what to use. It depends a lot on what specifically you want.

我的意思是将在附加功能而言是有用的?!?好吧功能,你寻找的是什么!

I mean what will be useful in terms of "additional features"?!? Well what features are you looking for!

反正作为一般规则,一个基于适配器的视图应该用于位置有一个显著量数据,该用户正在滚动视图的任何情况;这些都是很多不必创建整个视图层次的前期,以显示你的数据更加有效。他们也是唯一的,自动提供每个项目的选择等这样的功能。对于这一点,应用程序使用的主要观点是ListView中,虽然GridView的也可以使用。

Anyway as a general rule, an Adapter-based view should be used for any situation where you have a significant amount of data that the user is scrolling view; these are a lot more efficient than having to create the entire view hierarchy up-front to display your data. They are also the only ones that automatically provide per-item selection and other such features. The primary view for this that applications use is ListView, though GridView can also be used.

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

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