Set entry/exit animation

更新时间:
复制 MD 格式

The settings involved in this section is only applicable for entering and exiting from animation, not for the cross-page jumping in the mini program.

Enable the function of entry and exit animation

Add the parameter needAnimInTiny after starting the Mini Program, and set the value as true. The code example is as follows:

Bundle bundle = new Bundle();
bundle.putBoolean("needAnimInTiny", true);
MPNebula.startApp("2018080616290001", bundle);

Set entry animation

Add the animation resource files (tiny_fading_out.xml and tiny_push_up_in.xml) in the main project.

  • 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>

Set exit animation

Add the animation resource files (tiny_fading_in.xml and tiny_push_down_out.xml) in the main project.

  • 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>