GridView控件VS网格布局的Andr​​oid应用 [英] GridView VS GridLayout in Android Apps

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

问题描述

我必须使用一个网格来实现图片浏览器在Android中,我想知道GridView和网格布局的差别。

I have to use a grid to implement Photo Browser in Android, and I want to know the difference between GridView and GridLayout.

我使用的GridView动态显示图像(从SD卡)。

I'm using GridView to display the images dynamically (from SD card).

推荐答案

一个 GridView控件是一个的ViewGroup显示在二维滚动网格物品。在网格中的项目来自与该视图关联的ListAdapter。

A GridView is a ViewGroup that displays items in two-dimensional scrolling grid. The items in the grid come from the ListAdapter associated with this view.

这是你想要什么用(继续使用)。因为一个GridView从ListAdapter获取其数据,加载到内存中的唯一数据将显示在屏幕上的那个。 GridView的,很像列表视图再利用和回收他们的观点有更好的表现。

This is what you'd want to use (keep using). Because a GridView gets its data from a ListAdapter, the only data loaded in memory will be the one displayed on screen. GridViews, much like ListViews reuse and recycle their views for better performance.

而一个网格布局是一个布局,将它的孩子在一个长方形的网格。

Whereas a GridLayout is a layout that places its children in a rectangular grid.

据介绍在API级别14,而在支持库最近回迁。 其主要目的是为了解决在其它布局对准和性能问题。 看看这个<一href="http://android-developers.blogspot.com/2011/11/new-layout-widgets-space-and-gridlayout.html">tutorial如果您想了解更多关于网格布局。

It was introduced in API level 14, and was recently backported in the Support Library. Its main purpose is to solve alignment and performance problems in other layouts. Check out this tutorial if you want to learn more about GridLayout.

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

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