Applying Styles and Themes

When designing your application, you can use styles and themes to apply uniform formatting to its various screens and UI elements.

To create custom styles and themes:

1. Create a file named styles.xml in the your application's res/values directory. Add a root <resources> node.

2. For each style or theme, add a <style> element with a unique name and, optionally, a parent attribute. The name is used for referencing these styles later, and the parent indicates what style resource to inherit from.

3. Inside the <style> element, declare format values in one or more <item> element(s). Each <item> identifies its style property with a name attribute and defines its style value inside the element.

4. You can then reference the custom resources from other XML resources, your manifest or application code.

0 0

Post a comment