Chapter    7

Styles and Themes

Thus far, we have covered some fundamentals of the Android user interface (UI). In this chapter, we are going to discuss styles and themes, which help to encapsulate control-appearance attributes for easier setup and maintenance. Android provides several ways to alter the style of views in your application, in XML and in code. We’ll first cover using markup tags in strings and then how to use spannables to change specific visual attributes of text. But what if you want to control how things look using a common specification for several views or across an entire activity or application? We’ll discuss Android styles and themes to show you how.

Using Styles

Sometimes, you want to highlight or style a portion of the ...

Get Pro Android 5, Fifth Edition now with the O’Reilly learning platform.

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