简体   繁体   中英

How to implement sliding effect on the tab host indicator in android using fragment and view pager

I am new to android development and I want to implement a sliding effect on the tab host when the user slides left or right to change tabs implemented using fragments and view pager.

As soon as the user slides the page, the tab host indicator should also slide.

Facebook's new android app has this already implemented. Please refer to this image for a better understanding as to what I mean.

Sample Image

在此处输入图片说明

Thanks for any help available :)

It's possible to use ActionBar tabs, but this design mode has been deprecated in API 21 , and it works differently on different sized screens anyway which can lead to some undesired effects.

I used the classes in SlidingTabs example from Android developers to achieve this effect without having to include a 3rd party library dependency. There is a video tutorial as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM