More on XML Layout Attributes

Let’s go back over some of the attributes you added in fragment_crime.xml and answer some lingering questions you might have about widgets and attributes.

Styles, themes, and theme attributes

A style is an XML resource that contains attributes that describe how a widget should look and behave. For example, the following is a style resource that configures a widget with a larger-than-normal text size.

 ​ ​<​s​t​y​l​e​ ​n​a​m​e​=​"​B​i​g​T​e​x​t​S​t​y​l​e​"​>​
 ​ ​ ​ ​<​i​t​e​m​ ​n​a​m​e​=​"​a​n​d​r​o​i​d​:​t​e​x​t​S​i​z​e​"​>​2​0​s​p​<​/​i​t​e​m​>​
 ​ ​ ​ ​<​i​t​e​m​ ​n​a​m​e​=​"​a​n​d​r​o​i​d​:​l​a​y​o​u​t​_​m​a​r​g​i​n​"​>​3​d​p​<​/​i​t​e​m​>​
 ​ ​<​/​s​t​y​l​e​>​

You can create your own styles (and you will in

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

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