Friday, May 27th, 2011
In a recent article we looked at how to apply themes to Android apps. In order to further explore how themes work, it is necessary to try to understand precisely how styles and themes are applied to controls. To this end, we will look at building a simple custom control, and then learn how to apply styles and themes to it.
(more…)
Posted in Custom Controls, Spans, StyleSpan, Themes | 4 Comments »
Friday, May 20th, 2011
In this article we are going to look at a useful mechanism for applying styles to sections of text. While it is easy enough to style blocks of text using standard Android styles, there is also a mechanism for applying styles to text at a sub-block level. In HTML it is possible to add <strong>emphasis</strong> by applying inline markup as shown in this sentence. In Android we can apply a style to a TextView widget which will apply a given style to a specific block of text, but what if we want finer grained control like that of HTML? We use Spans: a mechanism for applying different styles to a block of text to character level.
(more…)
Posted in ImageSpan, Linkify, Spans, StyleSpan, Text, URLSpan | 16 Comments »