Slide 5
Slide 5
Styles
A style resource defines the format and look for a UI. A style can be applied to an individual
View (from within a layout file) or to an entire Activity or application (from within the manifest
file).
Defining Styles
A style is defined in an XML resource that is separate from the XML that specifies the layout. This
XML file resides under res/values/ directory of your project and will have <resources> as the root
node which is mandatory for the style file. The name of the XML file is arbitrary, but it must use the
.xml extension.
You can define multiple styles per file using <style> tag but each style will have its name that
uniquely identifies the style. Android style attributes are set using <item> tag as shown below
Styles-Example Using Styles
</LinearLayout>
The value for the <item> can be a keyword string, a hex color, a reference to another resource type, or
other value depending on the style property.
Action Listeners
Event Listeners