Android Programming with Kotlin for Beginners
上QQ阅读APP看书,第一时间看更新

Wiring up the UI with the Kotlin code (part 2)

Select the button next to the Load ConstraintLayout text. Find the onClick attribute and set it to loadConstraintLayout.

Select the button next to the Load TableLayout text. Find the onClick attribute and set it to loadTableLayout.

Now, the buttons will call the functions, but the code inside the loadTableLayout function is commented out to avoid errors. Feel free to run the app and see that you can switch to the ConstraintLayout by clicking the loadConstraintLayout button. But all it has is a Hello World message.

We can now move on to building this ConstraintLayout.