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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:20:34+00:00 2026-05-23T16:20:34+00:00

When is View.onMeasure(int widthMeasureSpec, int heightMeasureSpec) called? I have an Activity that needs to

  • 0

When is

View.onMeasure(int widthMeasureSpec, int heightMeasureSpec)

called? I have an Activity that needs to perform an action after onMeasure has been called.

My question is the same as the unanswered question posted here. The View documentation states that onMeasure is called when requestLayout() is called, which is apparently called by a view on itself when it believes that is can no longer fit within its current bounds.

However, this doesn’t tell me when my activity can assume that my View has been measured. I’ve used this code to extend ImageView to form TouchImageView. It was suggested here that I should use the onMeasure method to scale my image. I wish to update the value of a TextView after the ImageView has been measured in order to display the percentage by which the image has been scaled.

  • 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-23T16:20:34+00:00Added an answer on May 23, 2026 at 4:20 pm

    onMeasure is called when the parent View needs to calculate the layout. Typically, onMeasure may be called several times depending on the different children present and their layout parameters.

    The best way to do something when onMeasure is called is (I think) to create your own control, extend the ImageView and override onMeasure (just call super.onMeasure and do whatever else you would like to do).

    If you do that, just keep in mind that on Measure may be called several times with different parameters, so whatever is measured may not be the final width and height of what will be actually displayed.

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

Sidebar

Related Questions

I have an activity (BookMarks) that is called from main activity. BookMarks throw an
Root view is a UIImage View, it has subviews, those have subviews. My root
I made a custom component that extends View and overrides its onMeasure() , the
I have an application, which has a Spinner that I want populated with some
I am creating a custom view which will have a bitmap so that user
I am making a custom view that has 2 elemnts: a background that consists
I have an App that has a toolbar at the bottom of the screen
I have a custom View that is nested inside ScrollView and HorizontalScrollView like this:
My view-state to action-state transition does not appear to be happening. In the following
My view page has a Model which is represented by a List of Students.

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.