Skip to main content

Posts

Showing posts with the label aplha animation

Falling Animation in ANDROID using Animation of Translate

Falling animation is used to bring transition to a view between two X points or two Y points. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc… in res/anim/falling.xml suppose if transition to be done between two different X indexes use.. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="2000"/> </set> suppose if transition to be done between two different Y indexes use.. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <translate android:fr...

Scaling Animation In ANDROID

Scaling animation is used to scale a view. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc…  Here simply I will explain a scaling textview which you can apply to other views also... In res/anim/scale.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <scale android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="2000" /> </set> Java source code is given below public class Textviewanimation extends Activity { Animation fadeIn,fadeOut; TextView tv; Button startanimation; @Override public void onCreate(Bundle savedInstanceState) ...

TextView Animation or Alpha animation (FadeIn , FadeOut) in ANDROID

An Alpha Animation is animation that controls the alpha level of an object, i.e. fading it in and out. In Android, you can apply that fading effect to almost anything, from simple text, to images, buttons, check boxes, etc…   This can be done both from xml and from java class. Here I will explain a simple way to give a FadeIn and FadeOut for a textview on button click.. public class Textviewanimation extends Activity { Animation fadeIn,fadeOut; TextView tv; Button startanimation; Boolean fadeflag=true; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_textviewanimation); tv=(TextView) findViewById(R.id.textview); startanimation=(Button) findViewById(R.id.button1); fadeIn = new AlphaAnimation(0.0f , 1.0f ) ; fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut = new AlphaAnimation(1.0f , 0.0f); fadeO...