Android style 的继承

对于Android的 style 的 XML文件一样也能够继承android

好比下面的 CodeFont 的style样式:ide

<?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>

若是咱们想继承 覆写 CodeFont某些属性  能够是 配置一个 CodeFont.xxx字体

例如:覆写字体颜色spa

  <stylename="CodeFont.Red">
xml

<item name="android:textColor">#FF0000</item>
继承

</style>utf-8

扩展属性,例如字体大小it

<stylename="CodeFont.Red.Big">
<item name="android:textSize">30sp</item>
</style>
相关文章
相关标签/搜索