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

1627 questions
254
votes
25 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
  • 6,041
  • 4
  • 37
  • 58
246
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,657
  • 2
  • 16
  • 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,451
  • 20
  • 91
  • 133
154
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
  • 10,553
  • 21
  • 75
  • 125
46
votes
13 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,831
  • 4
  • 40
  • 61
44
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,423
  • 7
  • 48
  • 63
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
  • 114,585
  • 152
  • 739
  • 1,270
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…
32
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,737
  • 3
  • 16
  • 21
29
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
  • 962
  • 3
  • 13
  • 26
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,964
  • 5
  • 38
  • 54
24
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
  • 127,700
  • 71
  • 241
  • 295
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,731
  • 2
  • 19
  • 29
19
votes
8 answers

How to remove the space between rows of grid view in android

In android grid view there is extra space between the rows of grid view. I am not adding any space to the gridview. here is my xml files
Dipali
  • 1,148
  • 3
  • 13
  • 23
1
2 3
99 100