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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:41:17+00:00 2026-05-30T18:41:17+00:00

I have a wheel, I want to rotate it on its position. my code

  • 0

I have a wheel, I want to rotate it on its position. my code is rotating this image but its going to change its position. i want to keep this image on fix place.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    dialImage = (ImageView) findViewById(R.id.inner_dial);

    float rotation = (float) Math.toDegrees(90);
    Matrix matrix = new Matrix();
    matrix.postRotate(rotation);

    bMap = BitmapFactory.decodeResource(getResources(),
            R.drawable.inner_temp);

    dialImage.setBackgroundResource(0);

    Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(),
            bMap.getHeight(), matrix, true);
    dialImage.setImageBitmap(bMapRotate);

}

my xml file:

<?xml version="1.0" encoding="utf-8"?>

<ImageView android:background="@drawable/inner_temp"
    android:layout_height="wrap_content" android:id="@+id/inner_dial"
    android:layout_width="wrap_content" android:layout_alignParentLeft="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-30T18:41:18+00:00Added an answer on May 30, 2026 at 6:41 pm

    Save this rotate.xml in the anim folder in res.

    <?xml version="1.0" encoding="UTF-8"?>
    <rotate
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="infinite"
        android:duration="1200"
        android:interpolator="@android:anim/linear_interpolator" />
    

    Start your animation:

    dialImage.startAnimation(AnimationUtils.loadAnimation( this, R.anim.rotate ) );
    

    EDIT:

    To use rotate animation prgrammatically:

    RotateAnimation anim = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    dialImage.startAnimation(anim);
    

    Follow this link for detailed description.

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

Sidebar

Related Questions

I really don't want to have to reinvent the wheel with this one. There
I don't want to unnecessarily re-invent the wheel, but I have been looking for
I'm having difficulties adding momentum to my spinning wheel. I have this wheel (something
I want to hook a mouse wheel event to my scroll bar but i
Hello all i have a wheel picker working but at the moment it is
I have the following: Expression<Func<Car, int>> myExpr = car => car.Wheel.Tyre.Pressure; I want to
I want some window to never receive mouse wheel up/downs, i can control this
In MPMoviewPlayerController i have to play movie from a particular url.Its work fine.I want
I don't want to reinvent the wheel, so ask how others do this ...
I have a wheel image in the centre of my iPhone application which rotates.

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.