Make ViewPager overlap PageTitleStrip - android

I've been struggling with that for a while: Is it possible to force PageTitleStrip draw itself on the content of the ViewPager?
Here is the case:
The red line indicates the end of ViewPager content and the start of PagerTitleStrip. The brown background belongs to the hole activity. Blackboard and blue backgrounds are from fragments in pager. The screen is taken during scrolling so that 2 fragments can be seen. I want the icons from PagerTitleStrip to be displayed transaprently and party on the viewPager's content.
Any suggestions are highly appreciated.

I don't think it's possible to do this with the built-in ViewPager and PagerTitleStrip. You will have to make your own custom component based on these to get the effect you're looking for.

Related

In Android, how to make views transit between screens under viewPager?

So I have a single activity that controls a viewPager and this viewPager controls five fragments. In one of the fragments, there is an ImageView.
I want this imageView transit to the next page when I do a swipe left. More specifically, the position of this imageView will transit as I am swiping and once the swiping is done and the next fragment layout is completely shown on the screen, this ImageView should be a fixed location in this layout.
Does anybody know how I can make this work?
Thanks!
I think I know what you mean. It might be easier to make it a separate View on top of the pager, perhaps disabled so drags will go through it. and then you need to get a live reading of the position of the page. onPageScrolled on ViewPager.OnPageChangeListener is pretty cool and gives you what you need to place elements or do other transitionary effects based on the actual position of the Views in your ViewPager.

How to display adjacent tabs in ViewPager?

Here is a sample from duolingo app:
I want to implement a similar feature. I can use ViewPager to make swiping tabs. What I can't seem to figure out is how to display the adjacent tabs (part of it) alongside the current tab, which is in the center.
I initially thought of implementing this using horizontal LinearLayout, but I don't know how to make the snapping effect. And it also seemed more reasonable to use something which already provides you with swiping and snapping than try to implement your own.
Using ViewPager also let's me use fragments and memory management is also effective for cases of more than a few tabs.
Any help will be appreciated. Thank You in advance.

How to implement custom tabs titles animation and position

I have seen a great design in one app.
There is custom tabs representation and animation.
If the tabs doesn't has next(the last tab) there are only two tabs on the screen current at the center and adjacent.
And there is custom animation when switchng between tabs.
How to implement similiar tabs view and custom animation.
I will be grateful everyone for help.
You should take a look at this beautiful library: https://github.com/jpardogo/PagerSlidingTabStrip. It's exactly the same what you want I think. If you want to add some beatiful transition animations between the fragments, you can check this: https://github.com/jfeinstein10/JazzyViewPager

PagerTabStrip customization - moving tab background instead of standard indicator

I am trying to use PagerTabStrip in my app but need a little customization. My problem is that I want the tab background to be moved instead of the standard indicator. The image should explain it better:
Currently I don't show at all tab indicator, but use a tab background which is a selector (pressed & selected). This tab background behaves like a tab indicator but is jumpy and I would like to move it smoothly when sliding left/right.
I have have used the PagerTabStrip, got it to work and changed the height of the indicator to match the height of the tabbar but this didn't solve the problem because the indicator is drawn on top of the tabs and covers them. To solve the problem the indicator needs to be drawn behind the tabs. To do that I have modified PagerTabStrib and made a custom TabsContainer (by default LinearLayout is used in PagerTabStrip as a tabs container) an inner class which extends LinearLayout and overrides its onDraw() method where I want to draw the moving indicator. This way the indicator should be drawn behind the tabs, right? My problem with the code right now is that I don't get calls to onDraw() inside my custom TabsContainer. What do You think about this solution and about this problem? Do You see any better solution?
Thanks for any help.

Show portion of adjacent fragments in view pager

Is there some way to show a small portion of the adjacent fragments while using the ViewPager in Android compatibility package.
The view that I want to make will show the current fragment in center and the edges of the fragments which are before and after the current one on either side.
I believe a ViewPager indicator would be the best solution available. Showing that there are pages to either side.
http://androidforums.com/application-announcements/391561-android-viewpager-indicator.html

Categories

Resources