Comments (21)
I am facing the same issue as well. Some pointers on what you think is going on would be greatly appreciated!
from staggeredgridview.
I have almost same problem with you. For me, first top right image is placed below(seems like have margin at the top) than left image. So top left image located correctly.
Have you any idea? Thanks in advance :)
from staggeredgridview.
I have the same problem with you.
when I changed Item's height dynamically or changed the orientation.
the top item don't align sometime.
Please give me an ideal.
from staggeredgridview.
Same problem here, but one solution is found: Try to do not use any padding at top! this solves the problem here completely. To workaround i've added the padding into the cells inside the grid and not into the grid itself.
from staggeredgridview.
Hum, for me that doesn't work too. There's no padding at top in my code, but still problem caused.
from staggeredgridview.
mhh, is the a general padding instead of top padding used? Just to make sure: i mean the padding of the gridview itself not the cells in the grid.
Another thing i have done, is using the "ScaleImageView" from Maurycy Wojtowicz you find this one in the StaggeredGridView example from him (BTW: Thanks for this). This view will inform the grid about size changes which will occur in lazy loading...
from staggeredgridview.
Yes, I have no padding at GridView itself, also, I have very similar cell since I used ScaleImageView too.
In the example source code, author uses one of lazy loading source code, but I use universial image loader. however I don't think UIL is the problem...
from staggeredgridview.
Are you using an LinearLayout as the container for the grid-cells? I think there is one problem as well, just give the RelativeLayout a try!
from staggeredgridview.
I used LinearLayout at GridView wrapper, and RelativeLayout at gird cell. So I changed gridview wrapper as a RelativeLayout, but still have a same problem . ..
from staggeredgridview.
Ok, next problem figured out: If the Image Views changes size this problem ist back again. I had tested it with images which are all the same size. Just now i've tested it with "dynamic" size images and the problem occour's again. i Think this is a problem in size changing of images during the lazy loading, possibly there is some calculation which is not correct. I will try to figure out if i can fix this bug as soon as possible.
from staggeredgridview.
I have read the next workaround in a forum (http://www.androidviews.net/2013/01/pinterest-like-adapterview/). It seems to work for me!
// reset list if position does not exist or id for position has changed
if(mFirstPosition > mItemCount-1 || mAdapter.getItemId(mFirstPosition) != mFirstAdapterId){
Log.i(TAG, “item resetting position of the grid layout”);
mFirstPosition = 0;
Arrays.fill(mItemTops, 0);
Arrays.fill(mItemBottoms, 0);
if(mRestoreOffsets!=null)
Arrays.fill(mRestoreOffsets, 0);
}
Comment this code in StaggeredGridView.java in the library code , you can find it in onChanged() method of DataSetObserver()
from staggeredgridview.
Commenting out that part does not work for me. Subjectively it maybe seemed to happen less, but I just got a case where my top images were pretty badly aligned.
I really hope a fix can be found for this as I love this control and really want to make use of it ....
from staggeredgridview.
I downloaded this fork:
https://github.com/jess-anders/StaggeredGridView
And so far it seems to not be happening but I dont know that I've had long enough to convince myself that the issue is fixed.
I do lazy-load the images but the size of the image shouldn't be changing because the ImageView I pass back from getView is sized correctly.
I am seeing some worrying messages regarding "Inflation setting LayoutParams.width to -2 must be MATCH_PARENT"
I will play with it some more and see if the issue comes back.....
If not, I want to add a "threshold" scroller so I can be notified when the list is say 80% scrolled, so I can trigger a reload of new data, plus a callback when scrolling starts .... as well as the scroll stopped ....
from staggeredgridview.
Ok I cannot "break" the jess-anders version. Whatever they did seems to definitely fix this for me (w/out commenting out the code per sgallego's post)
from staggeredgridview.
if anyone has this problem or any gridviews rearranging, this workaround worked for me. Handle onclick events for all your child subviews in your item layout in the getview method of your adapter. seems like a bug but this definitely works for me.
from staggeredgridview.
I'll see if I can get the changes made by @jess-anders rolled back into the project.
from staggeredgridview.
I tryied all the above recomendations, but the problem still remains.
from staggeredgridview.
@jgeory have you tried the jess-andres version?
from staggeredgridview.
I faced same problem too, but found the trick after playing with the demo.
You have to set the margin programmatically just like the demo. Also i am using demo's ScaleImageView.
StaggeredGridView gridView = (StaggeredGridView) this.findViewById(R.id.staggeredGridView1);
int margin = getResources().getDimensionPixelSize(R.dimen.margin);
gridView.setItemMargin(margin); // set the GridView margin
gridView.setPadding(margin, 0, margin, 0); // have the margin on the sides as well
from staggeredgridview.
Hi, thanks for a great library. I tryed to use jess-andres version, but when I call adapter.notifyDataSetChanged(), gridview comes to start. Do you have any ideas? This is my code:
Parcelable state = gridView.onSaveInstanceState();
adapter.notifyDataSetChanged();
gridView.onRestoreInstanceState(state);
from staggeredgridview.
Problem was solved by using loader clases from StaggeredGridViewDemo https://github.com/maurycyw/StaggeredGridViewDemo/tree/master/src/com/example/staggeredgridviewdemo/loader
from staggeredgridview.
Related Issues (20)
- Staggered Grid View Height issue
- add scrollbar
- Having issue while using custom Typeface, it affects smooth scrolling of StaggeredGridView
- setOnItemLongClickListener not work's :/
- Header, Footer is not supported HOT 1
- notifyDataSetChanged not working HOT 2
- DPad Selection
- Error in StaggeredGridView.java
- Is there any way to display vertical scroll bar?
- ArrayIndexOutOfBoundsException
- SGV.onMeasure() does not recalculate mColumnTops/Bottoms/Lefts when SGV dimension changes HOT 2
- Set listSelector HOT 1
- auto set width and height StaggeredGridView Item
- No SetSelection(int index) method HOT 2
- Cannot show content below staggered gridview HOT 1
- scrollbar
- SwipeRefreshLayout HOT 3
- Missing support for RTL layout
- Is it possible to set a header view crossing columns?
- Error inflating class com.origamilabs.library.views.StaggeredGridView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staggeredgridview.