How to Add FloatingView Animation in Android?

In previous article, we focused on Shadow image with Material Shadow library and today we come with cool animation with View using FloatingView animation library in Android. It can make the target view floating above the anchor view with cool animation.

You can see demo(FloatingView Animation) below:

FloatingView in Android
FloatingView Animation in Android

Let’s move on to implementation of FloatingView Animation:

Build gradle

First of all we need to add dependencies in build.gradle.

dependencies {
compile ‘com.ufreedom.uikit:FloatingViewLib:1.0.2’
}

Create floating element

Use FloatingBuilder to create a FloatingElement

FloatingElement builder = new FloatingBuilder()
.anchorView(View)
.targetView(View)
.offsetX(int)
.offsetY(int)
.floatingTransition(FloatingTransition)
.build();

The use of FloatingBuilder can be configured to have:

  • anchorView :Anchor, is you want to float animation in which View above
  • target:Target, The view which you want to float
  • offsetX:X direction of offset, unit PX
  • offsetY: Y direction of offset, unit PX
  • floatingTransition : Floating effect, the default is ScaleFloatingTransition

Source: Add FloatingView Animation in Android » Tell Me How – A Place for Technology Geekier

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s