14

I want to change the animation style of Android's ViewPager class with using Android Animation Framework. Is it possible?

Emrah Ayanoglu
  • 466
  • 2
  • 6
  • 16

4 Answers4

6

See my answer at: Slowing speed of Viewpager controller in android, might be helpful.

You can further customize the Scroller class to change the Interpolator to something more extreme.

Community
  • 1
  • 1
marmor
  • 27,641
  • 11
  • 107
  • 150
  • I'm extending my pager class with pageAdapter coz i dont have fragment. I want to apply annimation on it.. How can i do it. i tried the code ViewPager.setObjectForPosition("--Pass fragment--", position); but here we have to pass fragment.. – Namrata Jan 08 '15 at 05:25
  • I'm extending FragmentPagerAdapter please help me your code seems to not work. the sInterpolator is d mainproblem.thanks – Cristiana Chavez Jan 09 '15 at 11:57
  • see the comments below the answer, you'll need to add: Interpolator sInterpolator = new DecelerateInterpolator(); – marmor Jan 11 '15 at 07:41
4

You can use new android-support-v4.jar to do it. Please reference the following official web page: Customize the Animation with PageTransformer http://developer.android.com/training/animation/screen-slide.html

3

Maybe this post can be helpful if you are looking for a different animation. This animation did not use android's native pager. There are some issues that should be solved but at all i think it is helpful

https://github.com/kgnkbyl/CustomViewPager

kgnkbyl
  • 737
  • 1
  • 5
  • 16
1

Look at the example here

http://code.google.com/p/maniana/source/browse/#git%2FManiana%2Fsrc%2Fandroid%2Fsupport%2Fv4%2Fview

Search ViewPager.java for mForcedScrollDurationMillis. It's a hack to control the smooth scroll speed.

It also require to remove ViewPager and its internal classes from the original jar

http://code.google.com/p/maniana/source/browse/#git%2FManiana%2Flib

Something other than slide may be more involved.

user1139880
  • 1,828
  • 3
  • 18
  • 27