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.
<style name="BigTextStyle"> <item name="android:textSize">20sp</item> <item name="android:padding">3dp</item> </style>
You can create your own styles (and you will in Chapter 20).
You add them to a styles file in res/values/ and refer to them in layouts like this: @style/my_own_style
.
Take ...
Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.