In android the default transition between activities is to slide from left to right.But with custom animations we can change that.First create a folder inside the res/drawable folder called “anim”.Then create a file named “fade.xml” and copy this code into it.
<? xml version = "1.0" encoding = "utf-8" ?> |
| < alpha xmlns:android = "http://schemas.android.com/apk/res/android" |
| android:interpolator = "@android:anim/accelerate_interpolator" |
| android:fromAlpha = "0.0" android:toAlpha = "1.0" |
| android:duration = "@android:integer/config_longAnimTime" /> |
create another file named “hold.xml” in the same place hold.xml.
| <? xml version = "1.0" encoding = "utf-8" ?> |
| < translate xmlns:android = "http://schemas.android.com/apk/res/android" |
| android:interpolator = "@android:anim/accelerate_interpolator" |
| android:fromXDelta = "0" android:toXDelta = "0" android:duration = "@andro id:integer/config_longAnimTime" /> and just before starting the activity write down the following code
|
No comments:
Post a Comment