Creating a user interface

A user interface (UI) is the primary means by which a user interacts with an application. The user interfaces of Android applications are made by the creation and manipulation of layout files. Layout files are XML files that exist in app | res | layout.

To create the layout for the HelloApp, we are going to do three things:

  1. Add a LinearLayout to our layout file
  2. Place the TextView within the LinearLayout and remove the android:text attribute it possesses
  3. Add a button to the LinearLayout

Open the activity_hello.xml file if it's not already opened. You will be presented with the layout editor. If the editor is in the Design view, change it to its Text view by toggling the option at the bottom of the layout editor. ...

Get Kotlin Programming By Example 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.