Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When w,h =0, onSizeChanged should not be continued... #177

Open
kyungin-park opened this issue Apr 15, 2015 · 1 comment
Open

When w,h =0, onSizeChanged should not be continued... #177

kyungin-park opened this issue Apr 15, 2015 · 1 comment

Comments

@kyungin-park
Copy link

I wanted to add this StaggeredGridView in PullToRefresh library,
but I failed it because onSizeChanged is called first while creating refreshable view (StaggeredGridView) on PullToRefresh.
And then onMeasure is called.
onMeasure can not remake mColumnLefts since onSizeChanged has already made mColumnLefts, mColumnBottoms, mColumnTops, etc even though w and h was 0.

So,

StaggeredGridView.java

@Override
protected void onSizeChanged(int w, int h) {
    super.onSizeChanged(w, h);

///////////////// This kind of code is needed.
    if(w <= 0 || h <= 0) {
        return;
    }

Please consider this.
Thank you a lot for your great work~~

@zyzof
Copy link

zyzof commented Apr 24, 2015

I had a similar issue on the Kindle Fire with the options bar along the right edge of the screen. The layout calculations were getting calculated initially using the whole screen width of 1280px, then again with (screen width - option bar width). I was able to fix this issue by re-calculating the StaggeredGridView's mColumnLefts if the mColumnWidth had changed. See #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants