Skip to content

Extension of Android ViewPager with a 3D swipe effect

Notifications You must be signed in to change notification settings

Andrwyw/ViewPager3D

 
 

Repository files navigation

ViewPager 3D

Screenshot 1 Screenshot 1 Screenshot 1

This project aims to provide a reusable ViewPager widget for Android. It is based on the ViewPager class from Androids V4 compatibility package. Because of that android-support-v4.jar needs to be included in the build path.

Dependencies

Features

  • 3D overscroll effect
  • 3D swipe effect
  • subtle fade out during swipe and over scroll

Usage

Layout

<!--
  The ViewPager3d replaces a standard android.support.v4.view.ViewPager widget.
-->
<de.inovex.android.widgets.ViewPager3D
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

You can control the 3D effect with XML attributes:

<de.inovex.android.widgets.ViewPager3D
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/view_pager"
    app:overscroll_rotation ="1.75"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

All attributes are optional.

  • overscroll_rotation (float): Determines the amount of rotation during over scroll. Maximum rotation angle is 90 degrees divided by this value. Default is 2
  • overscroll_translation (integer): determines the maximum amount of translation along the z-axis during the overscroll. Default is 150.
  • swipe_rotation (float). Controls maximum rotation during swipe. Maximum rotation angle is 90 degrees divided by this value. Default is 3.
  • swipe_translation (integer): Maximum z-translation during swipe. Default = 100.
  • overscroll_animation_duration (integer): Duration of animation when user releases the over scroll. Default is 400 ms.
  • animate_alpha (boolean): if true the alpha value of the children views is decreased as they scroll out of the screen. Default is false because of performance issues.

Activity

ViewPager3D is used like the standard ViewPager widget. http://developer.android.com/reference/android/support/v4/view/ViewPager.html

License

Licensed under the Apache License, Version 2.0

About

Extension of Android ViewPager with a 3D swipe effect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published