[android] GridView VS GridLayout in Android Apps

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.

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

This question is related to android grid android-gridview grid-layout

The answer is


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.

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.

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.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to grid

Order columns through Bootstrap4 Change grid interval and specify tick labels in Matplotlib Nested rows with bootstrap grid system? Meaning of numbers in "col-md-4"," col-xs-1", "col-lg-2" in Bootstrap Adding horizontal spacing between divs in Bootstrap 3 box-shadow on bootstrap 3 container Binding List<T> to DataGridView in WinForm Is there a GUI design app for the Tkinter / grid geometry? how to get selected row value in the KendoUI How to validate inputs dynamically created using ng-repeat, ng-show (angular)

Examples related to android-gridview

Gridview with two columns and auto resized images GridView VS GridLayout in Android Apps GridLayout (not GridView) how to stretch all children evenly

Examples related to grid-layout

Bootstrap 4, how to make a col have a height of 100%? Equal height rows in CSS Grid Layout Prevent content from expanding grid items How do I specify row heights in CSS Grid layout? Load arrayList data into JTable Grid of responsive squares Flex-box: Align last row to grid GridView VS GridLayout in Android Apps