Using buttons and TextView widgets from our layout with a little help from interfaces
To follow along with this project, create a new Android Studio project, call it Kotlin Meet UI
, and choose the Empty Activity template. You can find the code and the XML layout code in the Chapter12
/Kotlin Meet UI
folder.
First, let's build a simple UI by observing the following steps:
- In the editor window of Android Studio, switch to
activity_main.xml
and make sure you are on the Design tab. - Delete the auto-generated
TextView
, the one that reads "Hello world!". - Add a TextView widget to the top-center of the layout.
- Set its text property to
0
, itsid
property totxtValue
, and itstextSize
to40sp
. Pay careful attention to the case of theid
value. It has an uppercase ...
Get Android Programming with Kotlin for Beginners now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.