Curious question, do my Compose Functions finally ...
# compose
g
Curious question, do my Compose Functions finally use View.java to be rendered on the Screen, if not then how does the final rendering happen ? If there is any good resource available on this, please point me to that.
n
it uses a ComposeView to be on the screen
f
No, thankfully there is no View.java at the and 😌 But the final rendering is done using Skia just like the "old" system. Sadly I don't know about some in-depth article about the rendering but hey, it's Google I/O tomorrow so there might be some talk about it.
g
ComposeView extends ViewGroup ?
n
yes
g
which inturn extends View.java
n
yes, I'm not sure they are any way around that because it still has to use the Activity "system" provided in every Android phones
but the use of the "View" part seems hollow, if we look at the code of a composeView, you will not see calls/redefined draw(), onDraw() , so for the rendering part I would follow what @Filip Wiesner said
f
it uses a ComposeView to render on screen
I believe that
ComposeView
is just bridge to the View system and saying that it's used to render Composable functions is a little misleading. I haven't fact-checked this I think that there is no
ComposeView
if you directly use
setContent { // compose }
in your activity.
It's completely different drawing system based on Compose UI nodes and you can think of
ComposeView
as Canas of sorts. It's just a portal to a differrent world.
n
setContent
in
Activity
does use a
ComposeView
, but you are right on the rest and I changed my wording
f
Oh okay, my bad 🙂 To the original question, I think that Leland Richardson and Romain Guy talked a little bit about this process on the latest episode of Android Leaks podcast.
a
For rendering, Compose UI uses
RenderNode
APIs on API 23+ and
View
APIs on API 21-22.
If what you're asking is whether Compose UI reuses standard Android widgets, then the answer is no.
You can see all the internals here.
g
Thanks guys, will go through these.
a
A View is the lowest level construct Android exposes for UI that interfaces with the system. An Android window is nothing more than a View added to the WindowManager. Compose represents your UI as the contents of a View and uses that View as an interface to the rest of Android.
f
Hmmm, next time I'll rather keep my mouth shut when I am not 100% sure 😅 Sorry for the misinformation