Themes in the Android Framework

In the last chapter, we established a connection between the main UI elements. Our application does not look like one until it gets some color. To get colors, we will start with the main application theme. We will extend one of the existing Android themes and override it with colors we like.

Open styles.xml. Here, you will set the default theme defined for our application needs. We will also have several colors overridden. However, we will change the parent theme and customize it according to our wishes. We will update the theme according to the following example:

    <resources> 
 
      <style name="AppTheme"  parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:colorPrimary">@color/colorPrimary</item> <item ...

Get Mastering Android Development with Kotlin 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.