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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.