I,
Style can be applied to view and activity or application.
Application on view: Style = "", application on activity and application: Android: theme = "".
When a view is set with a style, but the attributes in this style are not applicable to this view, this view will simply ignore this parameter.
After Android: theme is used to set a style for the application or activity, each view in it inherits the style by default. If the view has its own style set, the attributes set in theme are overwritten.
Set a style for viewgroup. The view in the style does not apply the attributes in the style.
Style definition: (it can be placed in any file suffixed with ". xml". The file name does not matter, and the style name must be unique)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
</style>
</resources>
II,
Note the following points about style inheritance:
1. inherit the built-in style in Platform:
parent="@android:style/TextAppearance.Medium"
2. inherit the defined:
<style name="CodeFont.Red">
<item name="android:textColor">#FF0000</item>
</style>
Separated by ".", style: codefont. Red inherits from style: codefont.