How we handle in code: Compose vs Xml - devrath/ComposeAlchemy GitHub Wiki

1 - Language

  • In Compose, we use Kotlin only.
  • In XML, we combine XML and Java/Kotlin. As you can see, multiple languages are involved.

2 - Way we interact with these UI components

  • In Compose, we declare the UI composables and provide a state. When we need to alter the property of the composable, we change the state, and in turn, the corresponding property is changed.
  • In XML, we also declare the UI as XML and give a reference to it. When we need to modify the property of the UI element, we use the reference of the UI element to modify the property.

3 - Places to modify the UI element

  • In Compose, we can modify the property of a composable by changing the state. Also, it's confined to that composable.
  • In XML, we can use a drawable, XML, or code; thus, there are multiple places to modify the UI state.