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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:32:20+00:00 2026-05-28T14:32:20+00:00

I have an imageView and I am basically trying to make a thermometer style

  • 0

I have an imageView and I am basically trying to make a thermometer style gauge. I have added an image below for testing and I am basically trying to rotate the image. The first picture has the image in its standard layout. After trying to rotate the image, The width still fills the screen, but it scales the image down to make room for the corners, making the actual image appear smaller. I want the image to remain the exact same size, but rotate based on the Matrix passed to it.

Normal Image

Image rotated incorrectly, for me anyways

Here is the code I am using for the rotation:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);        

    circle = (ImageView) findViewById(R.id.imageView1);
    Bitmap myImg = BitmapFactory.decodeResource(getResources(), R.drawable.rotated);

    Matrix matrix = new Matrix();
    matrix.postRotate(45);

    Bitmap rot = Bitmap.createBitmap(myImg, 0, 0, myImg.getWidth(), myImg.getHeight(),
            matrix, true);

    circle.setImageBitmap(rot);        
}

So, I basically need the red/green circle edge to reach the edge of the screen. Is this possible with an imageView or will I need to write a custom view to allow stuff to be off screen? By the way, I am not actually gonna draw this whole circle, this is just an example to get my issue across.

  • 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-28T14:32:21+00:00Added an answer on May 28, 2026 at 2:32 pm

    You have to calculate the actual new width and height.
    try using some trigonometry

    newHeight = height/sin(alpha), where alpha is your rotation angle…

    newWidth = width/cos(alpha)
    

    then :

    Bitmap rot = Bitmap.createBitmap(myImg, 0, 0, newWidth, newHeight ,
                matrix, true);
    

    not sure about the calculation, I didn’t check it, but I think it correct, anyway, it’s a great hint 😉

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

Sidebar

Related Questions

I have added an imageView of size 300*300 into the interface in my ipad
I need a way to have a gray scale image in an ImageView and
Basically I have a Surface ToolKit ScatterView bounded to a list of image paths
I have an ImageView with an image, and an onclicklistener, and the image is
I have an image in ImageView. I need to know the exact (x,y) coordinate
I have drawn an arc which is basically parabolic in shape.I want an imageview
Basically, I want to render an image (bitmap) on an ImageView, but change its
I have a ImageView which shows a picture that has been taken from the
Basically I want to cut the corners of the first cell imageview and the
In my view i have ImageView.If i click ,it should open nextview. Please help

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.