Home > Blockchain >  How does Jetpack Glance widget works without XML? How does it convert to RemoteViews?
How does Jetpack Glance widget works without XML? How does it convert to RemoteViews?

Time:08-03

Jetpack released a tool called "Glance" that we can replace RemoteViews XML widgets.

I wonder how it converts compose layouts to RemoteViews.

Thanks.

CodePudding user response:

It does use XML underneath. It uses compose runtime to parse the node-tree, then it takes the corresponding pre-generated XML file and uses remoteviews to modify it's attributes. Then it composes everything into a single RemoteView that is sent to the AppWidget manager.

You can dive in into the code yourself. It's open source ;) https://cs.android.com/androidx/platform/frameworks/support/ /androidx-main:glance

  • Related