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

The Archive Base Latest Questions

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

I am working on animating an image view and that moves to the right

  • 0

I am working on animating an image view and that moves to the right and rotates at the same time. I can get the item to move using

    animation = new TranslateAnimation(0, level, 0, 0);
animation.setDuration(1000);
animation.setRepeatCount(0);
animation.setFillAfter(true);

Level is the variable I have defined at the time. I know the code for rotate is

RotateAnimation rotate = new RotateAnimation(0,rotate,0,0);
    rotate.setDuration(1000);
    rotate.setRepeatCount(0);
    animation.setFillAfter(true);
    bPick.setAnimation(rotate);

Again rotate is variable I have defined at the top.

My question is, how do I combine these two? I have tried using a thread

    private Runnable myThread = new Runnable() {

    @Override
    public void run() {
        while (level < 100) {
            try {
                myHandle.sendMessage(myHandle.obtainMessage());
                Thread.sleep(15);
            } catch (Throwable t) {
            }
        }

    }

    Handler myHandle = new Handler() {

        @Override
        public void handleMessage(Message msg) {

            level++;
            animation = new TranslateAnimation(0, level, 0, 0);
            animation.setDuration(1000);
            animation.setRepeatCount(0);
            animation.setFillAfter(true);
            bPick.setAnimation(animation);

        }
    };
};

That will have it move to the right fine, however if I try adding in rotation as well, it doesnt work, or it will crash.

Any help would be much appreciated, cheers

EDIT

The reason I require this is that I have a gauge with a pick.

Pick left

I require the gauge pick to move to the right while slowly rotating to the right. How much it moves to the right is based on a int variable set up. It will go from 0 – 100. 0 being the start position and 100, it will be moved to the right and look like this

Pick right

  • 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-27T08:24:50+00:00Added an answer on May 27, 2026 at 8:24 am

    You need to use an AnimationSet.

    An example in XML I made which moves an image from left to right, up and down and rotates, all at the same time.

    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <!-- Rotate -->
        <rotate android:fromDegrees="30" android:toDegrees="0"
            android:pivotX="50%" android:pivotY="50%" android:repeatCount="4"
            android:repeatMode="reverse" android:duration="2000"
            android:interpolator="@android:anim/linear_interpolator" />
        <!--  Left to right -->
        <translate android:fromXDelta="-50%p" android:toXDelta="150%p"
            android:fromYDelta="100%p" android:toYDelta="0" android:duration="10000"
            android:interpolator="@android:anim/linear_interpolator" />
        <!--  Up and down bob -->
        <translate android:fromXDelta="0" android:toXDelta="0"
            android:fromYDelta="30" android:toYDelta="-30" android:repeatMode="reverse"
            android:repeatCount="4" android:interpolator="@android:anim/linear_interpolator"
            android:duration="2000" />
    </set>
    

    Code example (not to replicate above):

    AnimationSet animationSet = new AnimationSet(true);
    
    TranslateAnimation a = new TranslateAnimation(
            Animation.ABSOLUTE,200, Animation.ABSOLUTE,200,
            Animation.ABSOLUTE,200, Animation.ABSOLUTE,200);
    a.setDuration(1000);    
    
    RotateAnimation r = new RotateAnimation(0f, -90f,200,200);
    r.setStartOffset(1000);
    r.setDuration(1000);
    
    animationSet.addAnimation(a);
    animationSet.addAnimation(r);
    imageView.startAnimation(animationSet)
    

    (Taken from here)

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

Sidebar

Related Questions

Working on a website that has Employee and Branch entities, using a database table
I have a working jquery image carousel that I was building. It's mostly finished
I'm trying to get a basic flip animation transition working when I push a
I'm working on a Cocoa project using Core Animation and I've got a custom
I have added some animation using jquery but it's not working: $('.test-container').click(function(){ $(this).css('background-color', 'rgb(119,
I'm working on a Snow Leopard app and I'm doing some view animations (swapping
Working on a bunch of forms at the moment and I'm finding that I
I have a iPhone app that I'm working on and it works alot like
im new to iPhone programming..in my app the timer is not working fine. can
I have to repeat the image sequence I am using with Thread and AnimationDrawable

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.