Closed 29jitender closed 4 years ago
I am wondering the same thing how can I use it with a scroll view?
i have this question too .
Me too :)
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);
}
......... }
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.