Questions tagged [android-gridview]

GridView is a subclass of AdapterView that displays items in a two-dimensional, scrollable grid.

GridView is a subclass of AdapterView that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter. The cell-data binding is made through an Adapter.

Reference

1619 questions
230
votes
22 answers

GridLayout (not GridView) how to stretch all children evenly

I want to have a 2x2 grid with a buttons inside. This is only ICS so I am trying to use the new GridLayout given. Here's the XML of my layout:
dnkoutso
  • 5,751
  • 4
  • 33
  • 56
229
votes
1 answer

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.
Lakshmi Sreekanth Chitla
  • 2,487
  • 2
  • 13
  • 16
182
votes
2 answers

Gridview with two columns and auto resized images

I'm trying to make a gridview with two columns. I mean two photos per row side by side just like this image. But my pictures have spaces between them, due to the fact that it's not the same size. Here is what I'm getting. as you can see the first…
rogcg
  • 10,281
  • 20
  • 84
  • 128
150
votes
3 answers

How ListView's recycling mechanism works

So I have this problem I had before, and naturally I asked for help on here. Luksprog's answer was great because I had no idea about how ListView and GridView optimized itself with recycling Views. So with his advice I was able to change how I added…
Andy
  • 9,963
  • 19
  • 71
  • 123
45
votes
6 answers

GridView rows overlapping: how to make row height fit the tallest item?

Like this previous person, I have unwanted overlap between GridView items: Notice the text, in every column except the rightmost one. Where I differ from that previous question is that I don't want a constant row height. I want the row height to…
Chris Boyle
  • 11,168
  • 7
  • 46
  • 62
38
votes
3 answers

How to fully replace listView/GridView with RecyclerView?

I've noticed that the new RecyclerView class, even though it makes things a bit cleaner, is lacking a lot of functionality that I'm familiar with: dividers, but this can be solved by looking at this post or this…
android developer
  • 106,412
  • 122
  • 641
  • 1,128
36
votes
3 answers

gridView with different cells sizes, pinterest style

Background GridView is a class that extends AdapterView , which means it shows cells in a grid-style efficiently, recycling old views to be shown as new ones when the user scrolls it. The problem Sometimes, you would want to get a special UI, which…
31
votes
2 answers

GridView rows outer margin

I cannot find out a way to add an outer margin to the GridView rows. I found the setHorizontalSpacing and setVerticalSpacing properties which add inner padding between the GridView rows, however it doesn't apply to the outer borders of the rows. I'd…
Diego Acosta
  • 1,597
  • 3
  • 15
  • 21
26
votes
11 answers

Can a GridView have a footer and header just like ListView?

A quick question: In ListView I use this code: list.addHeaderView(headerView); How to deal with it when working on gridview? Thanks.
necixy
  • 4,668
  • 4
  • 35
  • 52
26
votes
11 answers

RecyclerView Item Click Listener the Right Way

I use RecyclerView adapter to display data inside an activity, I want to implement onClickListener inside the activity, currently, I am setting onClickListener inside adapter as usual which works fine. public void onBindViewHolder(MyHolder holder,…
Amir Dora.
  • 2,358
  • 4
  • 28
  • 47
25
votes
4 answers

Android: BaseAdapter and getLayoutInflater on separate class file

Right now to populate my GridViews I'm using a extended BaseAdapter class on each of my Android Activities (which are most of them). In order to make it easier to read and maintain, I`m trying to put all the BaseAdapter code in a separate class…
Hito_kun
  • 894
  • 2
  • 13
  • 26
23
votes
4 answers

Android - Gridview or listview?

How do i create this kind of views in my application? (The screenshot is actually of an android application available in android market). I am confused as i assume that we can create the same kind of layout either by using Gridview or by using…
Paresh Mayani
  • 122,920
  • 69
  • 234
  • 290
23
votes
4 answers

In gridview adapter, getView(position == 0) was invoked too many times to measure layout when setImageBitmap() in a loader

I have a GridView for showing some icons. BEFORE I had read this Displaying Bitmaps Efficiently from Android developer site, I was decoding bitmap from local path directly in getView() of adapter, like this : public View getView(int position, View…
raywang
  • 455
  • 1
  • 4
  • 9
22
votes
7 answers

OnClickListener not working for first item in GridView

I have a problem with creating a GridView-based calendar. Here is the Grid: This is supposed to be a calendar populated with events, so I have my adapter implement OnClickListener and I set that listener for every button in the calendar. It works…
Valentin
  • 1,671
  • 2
  • 16
  • 28
19
votes
3 answers

Creating a table/grid with a frozen column and frozen headers

I am working on a small Android app. Part of what I need for this android app is to have a grid that is both horizontally and vertically scroll-able. However, the leftmost column needs to be frozen (always on screen, and not part of the horizontal…
Kevek
  • 2,419
  • 5
  • 15
  • 29
1
2 3
99 100