<!-- 样式的继承 -->
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00ff00</item>
<item name="android:typeface">monospace</item>
</style>
<!-- 如果是继承其本身的属性,则只需name:名字加点。。。 -->
<style name="CodeFont.Red">
<item name="android:textColor">#FF0000</item>
</style>
《==============我们在布局文件中======================》
<TextView
android:style="@/style/CodeFont.Red"
android:text="@string/hello_world" />
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00ff00</item>
<item name="android:typeface">monospace</item>
</style>
<!-- 如果是继承其本身的属性,则只需name:名字加点。。。 -->
<style name="CodeFont.Red">
<item name="android:textColor">#FF0000</item>
</style>
《==============我们在布局文件中======================》
<TextView
android:style="@/style/CodeFont.Red"
android:text="@string/hello_world" />