0

I am using the chrome custom tabs in my news app. i want the custom enter and exit animations, but when I use the code :

builder.setStartAnimations(this, R.anim.slide_in_right, R.anim.slide_out_left);
builder.setExitAnimations(this, R.anim.slide_in_left, R.anim.slide_out_right);

Android is not recognizing the layout files.

mani
  • 27
  • 8

1 Answers1

0

slide_in_right

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromXDelta="100%p" android:toXDelta="0"
               android:duration="@android:integer/config_mediumAnimTime"/>
</set>

slide_out_left

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromXDelta="0" android:toXDelta="-100%p"
               android:duration="@android:integer/config_mediumAnimTime"/>
</set>

You can use above transitions as a StartAnimation while for ExitAnimation you can use default android animations that is,

builder.setExitAnimations(this, android.R.anim.slide_in_left, android.R.anim.slide_out_right);
Aditya
  • 3,525
  • 1
  • 31
  • 38