2013년 2월 26일 화요일

slide up animation when start activity


Intent intent = new Intent(this, LoginActivity.class);
ActivityOptions options = ActivityOptions.makeCustomAnimation(this,
R.animator.slide_up, R.animator.fade_in);
startActivity(intent, options.toBundle());





-------slide_up.xml-------------------


<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="@android:integer/config_longAnimTime"
    android:fromYDelta="100%"
    android:toYDelta="0%" />




---------fade_in.xml----------------------


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <alpha android:fromAlpha="1.0"
      android:toAlpha="0.9"
      android:duration="@android:integer/config_mediumAnimTime" />
</set>




!! If put 0 in the place of "R.animator.fade_in" in ActivityOptions.makeCustomAnimation method, the background activity will turn black.


댓글 없음:

댓글 쓰기