Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Disclaimer: This is not a an actual 3D Animation Flip. This merely imitates it, though some don't agree. Give it a try and if you like it, great! If you don't, my apologies.</strong></p> <p>In my early days of learning to code, I was having issues implementing a proper 3D Animation flip, so I went with this, it simulated it enough to satisfy my needs, but to each her/his own. To do what I did, first make sure that you have a folder called anim under your res folder for your project. Then you will need to create two xml files (I have mine called from_middle and to_middle). Below is the code for each of those:</p> <p>from_middle.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="0.0" android:toXScale="1.0" android:pivotX="50%" android:fromYScale="1.0" android:toYScale="1.0" android:pivotY="50%" android:duration="500" /&gt; </code></pre> <p>to_middle.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="1.0" android:toXScale="0.0" android:pivotX="50%" android:fromYScale="1.0" android:toYScale="1.0" android:pivotY="50%" android:duration="500" /&gt; </code></pre> <p>After those are created, all you need is one line of code to run this animation, which you should be placed after you start your next activity:</p> <pre><code>overridePendingTransition(R.anim.from_middle, R.anim.to_middle); </code></pre> <p>Done! Now run it!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload