Android Styles are defined in an XML resource which is different from the XML that contains the layout properties. The XML resource file contains the <resources> which is a must for the style file. Inside the <resources> tag, you can define multiple styles. However, each style should have a unique identifier. To set Android Style, you need to set the resource file with <item> tag as shown below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomFontStyle">
<item name="android:layout_width">fill_parent</item>
<item name="android:capitalize">titles</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#000000</item>/>
<item name="android:textSize">15pt</item>
</style>
</resources>
Android Themes are android styles that are applied to the entire application. So when we apply an Android Style as a theme, each View in that activity is applied that is supported by the theme. To set a theme for your android application, you need to edit the <application> tag in your AndroidManifest.xml file. See the example below for your reference:
<application android:theme = “@style/CustomTheme”>
And suppose you want to apply the theme for a single activity of the entire application, then you can do so by using the <activity> tag as shown below:
<activity android:theme = “@style/CustomTheme”>
Android Studio provides a number of default themes that you can use directly in your application. To use default themes in Android applications, you can follow the example below:
<style name = “MyTheme” parent = “android.Theme.Dark”>
<item name = "android:layout_width"> fill_parent </item>
<item name = "android:capitalize"> titles </item>
<item name = "android:layout_height"> wrap_content </item>
<item name = "android:textColor"> #000000 </item>
<item name = "android:textSize"> 15pt </item>
</style>
As you can see we used the ‘parent’ attribute for using default themes. So, you need to use this attribute inside <style> tag.