Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem in showing animation effect
    primarykey
    data
    text
    <p>I have used animation in my app, and the animation that i use are slide_left and slide_right.But the problem is, the animation shown while sliding left is smooth and fine but when i slide right, the animation is not as smooth as shown while sliding left.So why these problem occurs.I have send you my code please check if there is any error..</p> <p><strong>code for slide_left.xml file</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"&gt; &lt;translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@android:integer/config_longAnimTime" /&gt; &lt;/set&gt; </code></pre> <p><strong>code for slide_right.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"&gt; &lt;translate android:fromXDelta="-150%p" android:toXDelta="0" android:duration="@android:integer/config_longAnimTime" /&gt; &lt;/set&gt; </code></pre> <p><strong>code for .java file</strong></p> <pre><code>public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { case MotionEvent.ACTION_DOWN: { //store the X value when the user's finger was pressed down m_downXValue = e.getX(); break; } case MotionEvent.ACTION_UP: { //Get the X value when the user released his/her finger float currentX = e.getX(); // going forwards: pushing stuff to the left if (m_downXValue &gt; currentX &amp;&amp; currentX &lt; 0) { ViewFlipper vf = (ViewFlipper) findViewById(R.id.flipview); vf.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_left)); } // going backwards: pushing stuff to the right if (m_downXValue &lt; currentX &amp;&amp; currentX &gt; 100) { ViewFlipper vf = (ViewFlipper) findViewById(R.id.flipview); vf.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right)); } break; } } return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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