GithubHelp home page GithubHelp logo

ykankaya / android-anim-viewpager-transitions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codepath/android-anim-viewpager-transitions

0.0 1.0 0.0 2.8 MB

Sample example for transitions between fragments within viewpager

Java 100.00%

android-anim-viewpager-transitions's Introduction

Android ViewPager transition animations

Sample example for transitions between fragments within viewpager This sample project shows how to do screen slides within a ViewPager.

Project details

  • Creates a ScrollView with TexView within it
  • Creates a fragment
  • Adds a ViewPager in Main Activity's layout
  • Customizes the slide animation with PageTransformer
    • Zoom-out page transformer

Zoom out custom animation

To provide custom animation to screen slide following steps are followed:

  1. Implement the ViewPager.PageTransformer interface and supply it to the view pager.
  2. transformPage() method is implemented to simulate Zoom-out page feel.
  3. Based on the position of the pages on the screen, you can create custom slide animations by setting page properties with methods such as setAlpha(), setTranslationX(), or setScaleY().
  4. The position parameter indicates where a given page is located relative to the center of the screen. It is a dynamic property that changes as the user scrolls through the pages. When a page fills the screen, its position value is 0. When a page is drawn just off the right side of the screen, its position value is 1. If the user scrolls halfway between pages one and two, page one has a position of -0.5 and page two has a position of 0.5.
  5. This custom Pagetransformer is passed to setPageTransformer() on ViewPager

Alt text

Open-source libraries/code references

https://developer.android.com/training/animation/screen-slide.html

Attribution

This code was created by Shrikant Pandhare in 2016 for use in CodePath sessions.

android-anim-viewpager-transitions's People

Contributors

shrikant0013 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.