

To define a set of styles, we need to create a new XML file in /res/values directory of our project and the root node of XML file must be a. Android Defining StylesĪs we discussed, we need to define a style in a separate XML resource file and use that defined style for the Views in XML that specifies the layout. In case if we use an entry from a resource file to style activity or app, then we can call it a theme. In simple words, if we use an entry from a resource file to style a view, then we can call it a style. If we apply TextviewStyle as a theme for an activity, then the text of all the views in activity appears in the same style. When we applied a style as a theme, the views in activity or app apply to the all style attributes that supports.

In android, theme is a style that is applied to an entire activity or app, instead of an individual View like as mentioned above. In following sections we will see the definition of TextviewStyle attribute. If you observe above code snippet, we removed all style attributes from XML layout and moved those attributes to a style definition called TextviewStyle.
