本文中的设置仅适用于进入和退出动画,不适用于小程序内部页面跳转。
开启进入/退出动画功能
在启动小程序时添加 needAnimInTiny 参数,值为 true。示例如下:
Bundle bundle = new Bundle();bundle.putBoolean("needAnimInTiny", true);MPNebula.startApp("2018080616290001", bundle);
设置进入动画
在主工程中加入动画资源文件,分别为 tiny_fading_out.xml 和 tiny_push_up_in.xml。示例如下:
tiny_fading_out.xml:<?xml version="1.0" encoding="utf-8"?><!--tiny_fading_out.xml--><set xmlns:android="http://schemas.android.com/apk/res/android"android:duration="300"><translate android:fromYDelta="0%" android:toYDelta="100%" /></set>
tiny_push_up_in.xml:<?xml version="1.0" encoding="utf-8"?><!--tiny_push_up_in.xml--><set xmlns:android="http://schemas.android.com/apk/res/android"android:duration="300"><translate android:fromYDelta="100%" android:toYDelta="0%" /></set>
设置退出动画
在主工程中加入动画资源文件,分别为 tiny_fading_in.xml 和 tiny_push_down_out.xml。示例如下:
tiny_fading_in.xml:<?xml version="1.0" encoding="utf-8"?><!--tiny_fading_in.xml--><set xmlns:android="http://schemas.android.com/apk/res/android"android:duration="300"><translate android:fromYDelta="100%" android:toYDelta="0%" /></set>
tiny_push_down_out.xml:<?xml version="1.0" encoding="utf-8"?><!--tiny_push_down_out.xml--><set xmlns:android="http://schemas.android.com/apk/res/android"android:duration="300"><translate android:fromYDelta="0%" android:toYDelta="100%" /></set>
该文章对您有帮助吗?