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 6354251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:32:49+00:00 2026-05-24T22:32:49+00:00

I’m trying to make two translate animations in android and having problems with them:

  • 0

I’m trying to make two translate animations in android and having problems with them:

  1. I’m trying to display an image entering from one side, and exiting the other, and to do repeatedly for a few minutes. I can see a moving, but every time the animation begins – i see a blink of the image for a millisecond.

This is my layout xml :

    <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:background="@drawable/bg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <ImageView  android:id="@+id/anim_image" android:src="@drawable/movimage"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:visibility="invisible"  android:layout_marginTop="30dp"
    />

</FrameLayout>

This is my anim xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
 android:fromDegrees="40" android:toDegrees="-40" android:toYScale="0.0"
 android:pivotX="40%" android:pivotY="30%" android:duration="4000" />
     <set>
        <translate 
            android:fromXDelta="200%p" android:toXDelta="-150%p" android:fromYDelta="20%"
            android:toYDelta="10%" android:duration="4000" android:zAdjustment="bottom" />
    </set>
 </set>

And in my java class i’ve created a countdowntimer which every onTick calls:
image.startAnimation(anim);

I also tried to listen to the animation:
anim.setAnimationListener(this);

And add to the onAnimationEnd:
image.setVisibility(View.GONE);

But it didn’t help me.
Does anyone know what can i do to fix it?

—

  1. I’m trying to show a “falling star” image – i’ve created a small png file (30px*30px) and im trying to position it in one edge of the screen and let it move to the other and dissapear. But every code i write in the anim XML doesn’t doing it!
    Can anyone help me with writing the animation correctly?

I’ve wrote: translate
android:fromXDelta=”100%p” android:toXDelta=”-100%p” android:fromYDelta=”0%p”
android:toYDelta=”100%p” android:duration=”500″

And it didn’t work..


edit: I’ve found a solution:

I’ve found what was wrong. I’ve wrote a code with CountDownTimer for repeating, instead of using the animation’s repeat option. I’ve changed my XML to be:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:startOffset="1000"
>
    <rotate
            android:repeatCount="infinite" android:repeatMode="restart" android:fillAfter="false"
            android:fromDegrees="40" android:toDegrees="-40" android:toYScale="0.0"
            android:pivotX="40%" android:pivotY="30%" android:duration="4000" />
     <set>
        <translate 
            android:repeatCount="infinite" android:repeatMode="restart" android:fillAfter="false"
            android:fromXDelta="100%p" android:toXDelta="-100%p" android:fromYDelta="20%"
            android:toYDelta="10%" android:duration="4000" android:zAdjustment="bottom" />
    </set>
 </set>

and now it works without those blinks in the screen.
Also for the falling star, i’ve changed the XML to this:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate 
            android:repeatCount="infinite" android:repeatMode="restart" android:fillAfter="false"
            android:fromXDelta="100%p" android:toXDelta="-100%p" android:fromYDelta="0%p"
            android:toYDelta="100%p" android:duration="2500" android:zAdjustment="bottom" />
     <set>
     <alpha 
        android:repeatCount="infinite" android:repeatMode="restart" android:fillAfter="false"
        android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="2500" />
    </set>
 </set>

and now it works perfectly!

  • 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-24T22:32:50+00:00Added an answer on May 24, 2026 at 10:32 pm

    I think that the imageView comes back to its original position after the animation is completed. You can try having android:fillAfter="true|false"(try one of it) in the xml of the translate animation. or try setFillAfter(boolean) on the animation object if you are loading it using the AnimationUtils.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

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.