Posts

Showing posts with the label Animation

Interpolator Animation Android

Image
This example will show you how to use different interpolators provided by android. This example, will show you both the way to use interpolator via XML or java. An interpolator defines the rate of change of an animation. This allows the basic animation effects (alpha, scale, translate, rotate) to be accelerated, decelerated, repeated, overshoot, cycle, bounce, etc. Main code:- (Using XML) <? xml version= "1.0" encoding= "utf-8" ?> < set xmlns: android = "http://schemas.android.com/apk/res/android" android :duration= "1500" android :interpolator= "@android:anim/bounce_interpolator" > // set Interpolator < translate android :fromXDelta= "0%p" android :toXDelta= "0%p" android :fromYDelta= "0%p" android :toYDelta= "80%p" /> </ set> Interpolator Animation using java:-  1) Create an animation file.   up_to_down_animation.xml <? xml version="1.0...

Shared Animation

Shared animation is provided by android. It will animate the view from one position to another position while the new fragment or activity is entering. This Example will show you how to use shared animation in the activity. Note: Before getting started you have to check that your activity must extend AppCompatActivity or ActivityCompat. Steps:- 1) Open style.xml and add transition event true. 2) Add the string in string.xml to specify the name of the animation. Y ou can give the static name also but the name must be the same in both the view. 3) Give android: transition name to view you want to move. 4) Add compact animation code to start the animation. So let's start with changing the style . So do that first open the style.xml file add the below code in it. <style name="AppTheme.NoActionBar">     <item name="windowActionBar">false</item>     <item name="windowNoTitle">true</item>     <item name=...