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

The Archive Base Latest Questions

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

Is there a way to manually scale a view while making sure the position

  • 0

Is there a way to manually scale a view while making sure the position translates properly? The only way I can scale it right now is to update the LayoutParams by essentially multiplying the width and height my a scale factor. This works okay but I’m not sure about how to translate the position properly. Further, I want to scale the view with the pivot being the center as well. I’m actually able to perform the behavior I want with by using the ScaleAnimation like so,

ScaleAnimation anim = new ScaleAnimation(fromX, toX,
                fromY, toY, ScaleAnimation.RELATIVE_TO_SELF,
                0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);

However, the actual view’s bounds are not adjusted. The majority of scaling implementations and help always deal with an ImageView so I figured it’s worth asking for a View only. I’d be greatly appreciative if any has any ideas on this matter.

  • 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-28T06:20:27+00:00Added an answer on May 28, 2026 at 6:20 am

    It sounds like you want to scale a View, but scale it from the center of the View. This is tricky because the View is positioned based on it’s top and left offset from the top left corner of it’s parent.

    So — if you have a view that is 100px from the top, and 100px from the left, and the size is 50px by 50px – and you want to scale it by +10%:

    width = 50px * 1.1 = 55px;
    height = 50px * 1.1 = 55px;
    

    but those extra 5px will be added to the right and bottom of the View, right? so we need to change the offset of the View to adjust:

    top = 100px - ((100px * .1) / 2) = 97.5px
    

    (same for the left, obviously).

    using this pattern, you can scale the view in a way that keeps the center point consistent.

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

Sidebar

Related Questions

Is there a way to manually increase / decrease the timeout of a specific
Is there any way to manually create fold points in code in Eclipse? I
Is there any way to manually remove an object which the garbage collection refuses
Is there a way that I manually have a user look up the current
Is there way in next piece of code to only get the first record?
is there way thats i can preselect an item when the page loads or
Is there any way to manually decorate function names in MS C++? I'm going
Is there a way to manually update the current location on MKMapView and have
Is there a way to manually increment and decrement the count of a shared_ptr
Is there a way to manually set a WPF Window's location like in Windows-Forms

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.