Home > Mobile >  How do I create a button in kotlin without xml?
How do I create a button in kotlin without xml?

Time:05-13

How do I make a button without any XML? I tried XML but it did not work and it is "Old" I heard.

CodePudding user response:

Yeah, using XML is old but it's the standard way of defining views in Android. Nowadays exist alternatives to that such as Jetpack Compose which takes a more React style when declaring the GUI where you write @Composable functions that produce a UI. Quite nice.

In any case you can create the views yourself programatically but it's much more tedious, less maintainable and imho

  • Related