That's the idea:
A ViewPager(Horizontal) insde ScrollView(Vertical). ViewPager will show diferents fragments depending on the tab, and has vertical scroll to show all fragment view on the screen.
But the thing is ViewPager isn't showing the fragment entirely, it doesn't expand the fragment's height or the ScrollView height.
There's a way to expand dinamically the ViewPager height or the ScrollView height to show completely the fragment using scroll?
<ScrollView>
<ImageView/>
<ViewPager>
<PagerTabStrip/>
</ViewPager>
<Button/> </ScrollView>
Rather than putting the ScrollView outside the ViewPager, instead you should make any views that populate the ViewPager (and need to scroll) ScrollViews.
This way each view (in the view pager) will have it's own vertical scroll offset that will be remembered as you page through the views.
Related
I have a scrollview which has some view along with the view pager in its bottom ,which has grid view inside it. when moved to the next activity and resumed to the activity the viewpager which is in the bottom scrolls to the top.
I have no idea to redirect the scrollview page with viewpager without changing its scroll position.Any suggestion??
I have implemented Vertical ViewPager from this: Android: Vertical ViewPager
I have a fragments which contains ScrollView inside. What I want to do is to switch the pages only when the ScrollView inside has reached at the end. When ScrollView is at the end, further scrolling should switch the pages in ViewPager.
I followed exactly this link at androidhive of simple tabs and created a tab layout with fragments of different heights. The tab layout is inside coordinator layout along with view pager. I have some textviews after the coordinator layout. And I want coordinator layout to take only space required by fragments, so that textviews is shown adjacent to even the shorter fragment. But using wrap_content in height of coordinator hides the fragments and only shows tab titles. If I set height to 1000dp, it shows both fragments but there is lot of blank space between smaller fragment and textview. How and what should I set height to get desired result?
I will paste code if required.
I currently have this situation with smaller fragment, and I want the "FOUR" to be just below "ONE" of fragment. If I set height of coordinator layout to wrap content, no fragment is shown at all.
So I have a Fragment which uses a CoordinatorLayout with a NestedScrollView inside. Inside that NestedScrollView is a ViewPager. Each item of that ViewPager is a CoordinatorLayout with a NestedScrollView inside.
The behavior I want is that when each item inside the ViewPager is scrolled up and down, my custom BottomBar will disappear and reappear.
When I scroll up and down, however, the BottomBar disappears and reappears, but the content in the innermost ScrollView does not move. This is the problem
Code posted below, any advice would be helpful.
Things I've tried:
Calling ViewCompat.setNestedScrollingEnabled() on nearly every view in the hierarchy that could scroll.
Calling requestDisallowInterceptTouchEvent(true) on the outermost NestedScrollView.
Main Activity:
Fragment w/ outer NestedScrollView:
Each item in ViewPager:
app:layout_behavior="#string/appbar_scrolling_view_behavior"
set this line in ViewPager it will help you
I have an activity layout in which I have a viewpager that contains a couple of fragments. One of the fragment holds a listview (image sample attached).
What I'm trying to do is to scroll the listview and stick the TabStrip to the top of the layout, so when you are scrolling the list, the viewpager's fragment titles are always visible but you can see the entire listview content.
Above the viewpager there are views that needs to scroll up when the listview is scrolling.
Is any way to achieve this?
I've tried with scrollview and placing the viewpager inside it, but it doesn't work because the viewpager doesn't display at all.
Please help!
i've found the solution by using this nice library from github!!!
noties/Scrollable