The introduction of Android Resource Style

Android Style

Style is defined in a separate XML source of XML that specifies the layout.

This XML file is under res / values / directory of your project and will have a <resources> as the root node required to file style.

XML file name is arbitrary, but must use an extension (.xml).

You can specify multiple Style per file using <style> but each style will have a name that uniquely identifies Style.

<?xml version="1.0" encoding="utf-8"?>
   <style name="CustomFontStyle">
      <item name="android:layout_width">fill_parent</item>
      <item name="android:layout_height">wrap_content</item>
      <item name="android:capitalize">characters</item>
      <item name="android:typeface">monospace</item>
      <item name="android:textSize">12pt</item>
      <item name="android:textColor">#00FF00</item>/> 

Values ​​for <item> can be a string of keywords, hex color, a reference to another source type, or other values ​​depending on the style property.

using Style

Once your style is defined, you can use the XML layout file (Eg activity_main.xml) You use the following style attributes.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
   android:orientation="vertical" >
      android:text="@string/hello_world" />

Source: Master Android (App)

Post Author: Study