StaggeredGridView
This is a modified version of Android’s experimental StaggeredGridView. The StaggeredGridView allows the user to create a GridView with uneven rows similar to how Pinterest looks. Includes own OnItemClickListener and OnItemLongClickListener, selector, and fixed position restore.
To use StaggeredGridView in your projects, simply add this project to your workspace then add it as a library project to your current project.
Demo link: https://github.com/maurycyw/StaggeredGridViewDemo
28 comments on “StaggeredGridView”
Leave a comment


Hi, Really interesting. But cannot found the “com.origamilabs.library.views.StaggeredGridView”.
Any help?
Thanks
@Adi: clone the library repo here: https://github.com/maurycyw/StaggeredGridView
Add library reference to your project: “project.properties”
Hello,
I tried to use StaggeredGridView within a Fragment in an ActionBar , the MainActivity extends FragmentActivity and implements
ActionBar.TabListener. And I have another class extends Fragment but I always get NullPointerException in the following line in my “Fragment” class:
StaggeredGridView gridView = (StaggeredGridView) this.getView().findViewById(R.id.staggeredGridView1);
Could you please help my in using StaggeredGridView within a Fragment instead in Activity?
Thank you & Best Regards
I’ve solved the problem ,
Yes it takes long long time but finally it now works , the problem is only that I have to define a view object in onCreaView method of the fragment, as this line:
View view = inflater.inflate(R.layout.fragment_featured,container, false);
then use this line:
StaggeredGridView gridView = (StaggeredGridView)view.findViewById(R.id.staggeredGridView1);
instead of :
StaggeredGridView gridView = (StaggeredGridView) this.getView().findViewById(R.id.staggeredGridView1);
Thank you,,,
Any one have any how to add on setScrollListener
i didn’t find a way to add that
[...] could use StaggeredGridView or depending on your needs, you could also use [...]
It seems really nice.,
But. I cannot add this library to my code which i have coded using ActionBar sherlock and sliding menu lib.
My code working fine with action bar and sliding menu., but when i tried to add this library to my project it gives error as “JAR MISMATCH- ANDROID SUPPORT LIB V4 IN STAGGERED GRID VIEW”
can you please help. how can i use this library when i am using sherlock.?
Thanks in advance:-)
Delete Support Lib V4 in folder libs from the procject. not from Staggeredgridview library
There is a still conflict with sherlock actionbar lib v4.
Hei, I did all configuration well with no error. But no Image shown, because I don’t know how to add the images to StaggeredGridView…
Anyone can help?
I have the same problem with you, have you solved it?
Still cannot
, have tried with ArrayAdapter and ImageAdapter as normal GridView works. but still shown nothing.
Did you try SimpleAdapter? I have changed the StaggeredGirdAdapter into subclass of SimpleAdapter.
Hi,
I using this library and I’m getting some weird behavior.
I’m using ResourceCursorAdapter in order to populate the grid,
The problem I see is that the Item View (i.e. the ScaleImageView in your example) is stretched.
My grid item is some relative layout with some TextViews and two ImageViews.
Does anyone ran into this problem?
hava any to pull to refreash?
I can’t find onscrollListener too, have any method to help me know the gridview have scroll to bottom ?
How does one set an onClick listener to this? Any help is great.
[...] , as found on AndroidViews.net. [...]
Can anyone tell me if it is possible to add animations to this view so that it works similar to Google Plus?
I would like to have the app add additional views when you get to the bottom of the scroll and have them float up from the bottom as in Google Plus. I tried making some changes to my getView() function along the lines of several different listview animation examples I have seen, but all of them resulted in a null exception in the choreographer, so I am not sure if it just can’t be done there.
[...] I want to create a grid like in pinterest or wish android applications. I already found some solutions like http://www.androidviews.net/2013/01/p…; [...]
[...] I want to create a grid-like in Pinterest or Wish Android applications. I already found some solutions like http://www.androidviews.net/2013/01/pinterest-like-adapterview/ [...]
[...] I want to create a grid-like in Pinterest or Wish Android applications. I already found some solutions like http://www.androidviews.net/2013/01/pinterest-like-adapterview/ [...]
I try to handle click event using below code:
gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(StaggeredGridView parent, View view, int position,
long id) {
// TODO Auto-generated method stub
}
});
But it show me error that
The method setOnItemClickListener(StaggeredGridView.OnItemClickListener) in the type StaggeredGridView is not applicable for the arguments (new AdapterView.OnItemClickListener(){})
Please help me.
Hi
I solve my own problem just write below code:
gridView.setOnItemClickListener(new StaggeredGridView.OnItemClickListener() {
@Override
public void onItemClick(StaggeredGridView parent, View view, int position,
long id) {
// TODO Auto-generated method stub
}
});
I not using List url ?
I not can add item for my list
Thanks
Hi this is awesome, but I am facing with below error
android-apt-compiler: [StaggeredGridViewDemo] /Users/keyur/Android/StaggeredGridViewDemo/res/layout/activity_main.xml:9: error: No resource identifier found for attribute ‘numColumns’ in package ‘com.example.staggeredgridviewdemo’
How to resolve this issue ?
Finally was able to resolve this issue with below change in manifest file of demo.
old value
xmlns:staggered=”http://schemas.android.com/apk/res-auto”
Replace to new value
xmlns:staggered=”http://schemas.android.com/apk/lib/com.origamilabs.library”
anyone do it success?