kmshack / Android-ParallaxHeaderViewPager

DEPRECATED
Apache License 2.0
1.39k stars 336 forks source link

How can i use this with gridview. #10

Closed 29jitender closed 4 years ago

29jitender commented 9 years ago

Inside SampleListFragment you are adding a blank header what if we want to use a GridView or scrollView rather than ListView and in adjustScroll we can setSelectionFromTop in listView or setScroll in ScrollView but what about GridView ( setSelection is not working perfectly )? How can we achieve that without setting a blank header.

nasserprofessional commented 9 years ago

I am wondering the same thing how can I use it with a scroll view?

xifan-xf commented 9 years ago

i have this question too .

gogui63 commented 9 years ago

Me too :)

zty5678 commented 9 years ago

It seems that the following code may work. I'm using https://android.googlesource.com/platform/packages/apps/Gallery2/+/idea133/src/com/android/photos/views/HeaderGridView.java as the GridView which could have a HeaderView.

class SampleGridFragment extends ScrollTabHolderFragment implements OnScrollListener{ HeaderGridView mGridView; ......... @Override public void adjustScroll(int scrollHeight) { if (scrollHeight == 0 && mGridView.getFirstVisiblePosition() >= 1) { return; } mGridView.smoothScrollToPositionFromTop(mGridView.getNumColumns(), scrollHeight, 0);

}

......... }