-1

I was trying to understand what's the meaning of inflating a view and found this topic:

What does it mean to inflate a view from and xml file?

But I was not satisfied by the accepted answer, as it mention that inflating a view causes its rendering, while I think it is only responsible of the conversion of the XML layouts into the corresponding code by building the View objects, and I'm wondering if it's the case or not, and if not, what can initiate the drawing of the view on screen?

Can anyone clarify my questioning by providing trusted or official documentation?

  • 1
    Why not post it as a comment in the same thread? – gtxtreme Sep 07 '21 at 09:20
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 07 '21 at 22:21
  • @Community, My question is quite simple, and I formulated it twice, it is pretty understandable for someone who want to understand. – Salim Mazari Boufares Sep 08 '21 at 07:46

1 Answers1

1

Every subclass of View overrides the onDraw() method from the View class. This is where the View actually specifies how it will be drawn on the screen. All drawing takes place on the View's Canvas, and the dimensions of the Canvas are specified by the width and height attributes you set in your layout file for that View.

For instance, here's the onDraw() method for TextView:

https://android.googlesource.com/platform/frameworks/base/+/jb-mr0-release/core/java/android/widget/TextView.java#4738

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35