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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:40:56+00:00 2026-05-22T19:40:56+00:00

i was just looking up how the views are drawn in android and i

  • 0

i was just looking up how the views are drawn in android and i was reading the documentation that in provided on the developer site. i understood most of it, except for the following question:

setting context for the question

when a view is drawing itself, it will first call measure on itself and all its children.. wherein it will force constraints on its children based on those forced on it by its parents.

question

now consider that i am drawing a label.. and for some reason the constraint placed on it by its parent only allows it to be drawn in a 60px x 60px space. i have made this label, meaning that it is a custom view. and now i am writing the code for draw method. Over here i am drawing text on the label which has 5 characters and the text size is 20. now for the text to be drawn i would in total require (20*5) 100px, but i can only draw 60px width..
should the measure method not consider the draw method before it returns?

thank you in advance.

  • 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-22T19:40:57+00:00Added an answer on May 22, 2026 at 7:40 pm

    The draw method is not considering the needs. OnMeasure is the one that does it. In the onMeasure you return your desired size. This is the place where the component and their parents ‘negotiate’ the size. Of course, you can always end up with insufficient space. But this holds true for all other components – giva a TextView 5px and it will be 5 px. OnDraw is meant just to do that – to draw. All the calculations for the size should have already been made in onMeasure. Newer Android versions have View.MEASURED_STATE_TOO_SMALL (API >= 11) that is returned in onMeasure and indicates that you’re out of space 🙂

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

Sidebar

Related Questions

Just looking on resources that break down how frames per second work. I know
I'm just looking through some of the webmaster stats that Google provides , and
Just looking for a good PHP Image Library, I want to display images with
Basically just looking to see if you can capture an image from the webcam
I was just looking at the MySql database created by drupal after I installed
I'm just looking for suggestions on the best way to do this... I need
I'm just looking for a little guidance as to how i might implement a
I am just looking at sorting an NSArray of NSNumbers into numeric order but
I was just looking at this code and i don't understand what RETURN TRUE
I was just looking at the jQueryUI button plug-in and noticed this $(button, input:submit,

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.