Android 应用中的 GridView VS GridLayout [英] GridView VS GridLayout in Android Apps

查看:30
本文介绍了Android 应用中的 GridView VS GridLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用网格在 Android 中实现照片浏览器.所以,我想知道GridView 和 GridLayout 之间的区别.

I have to use a Grid to implement Photo Browser in Android. So, I would like to know the difference between GridView and GridLayout.

这样我就可以选择正确的了.

So that I shall choose the right one.

目前我使用 GridView 来动态显示图像.

Currently I'm using GridView to display the images dynamically.

推荐答案

A 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 获取其数据,因此加载到内存中的唯一数据将是显示在屏幕上的数据.GridViews,很像 ListViews 重用和回收它们的视图以获得更好的性能.

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.

GridLayout 是一种将其子项置于矩形网格.

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

它是在 API 级别 14 中引入的,最近在支持库中被反向移植.它的主要目的是解决其他布局中的对齐和性能问题.查看此教程,如果您想了解有关 GridLayout 的更多信息.

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.

这篇关于Android 应用中的 GridView VS GridLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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