Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6580621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:03:04+00:00 2026-05-25T16:03:04+00:00

I use animation in my app. Animation that I use is slide_left and slide_right

  • 0

I use animation in my app. Animation that I use is slide_left and slide_right. I faced the following problem: 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 this problem occurs? Here is my code please check if there are any errors.

Code for slide_left.xml file

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

Code for slide_right.xml

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

Code for .java file

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 > currentX && currentX < 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 < currentX && currentX > 100)
            {                   
                ViewFlipper vf = (ViewFlipper) findViewById(R.id.flipview);                                     
                vf.setAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_right));                                
            }                                       
            break;
        }
    }
    
    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:03:05+00:00Added an answer on May 25, 2026 at 4:03 pm

    Put this Code for Left Side…

    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="@string/duration"/>
        <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="Duration" />
    </set>
    

    And Put this Code for Right Side…

    <?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="@string/duration"/>
        <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="Duration" />
    </set>
    

    in that just Add your Duration…

    It’s Work…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a basic iOS app that doesn't use any fancy animations except for
I am starting to learn to use UIView animation. So I wrote the following
I m creating a game, in that i want to use some animation, but
I'm tinkering with an iPad app that (like many iPad apps) doesn't use the
There is that app called turkey blast: reloaded (link below). The graphics and animation
Need help with a problem. Goal I'm putting together an iOS book app that
Is it possible to use Core Animation to change something else than properties of
If I'm looking to use Core Animation to fade a view in and out
I am new to R and trying to use the animation package. From the
I have a little keyframe animation I use occastionally, it looks like so: @-webkit-keyframes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.