android style的继承方式

877 阅读1分钟

两种方式:

1,通过parent方式继承

    
<style name="pickprof_guide_text">
        <item name="android:textSize">16.0sp</item>
        <item name="android:textColor">#ff333333</item>
</style>
<style name="pickprof_guide_text_small" parent="@style/pickprof_guide_text">
        <item name="android:textSize">13.0sp</item>       
</style>

2,通过 “.” 继承

style的name为在被继承style的name后面添加继承的stylename。
注意:这种方式只适用与自定义的style继承

     <!-- Base style for animations.  This style specifies no animations. -->
    <style name="Animation" />
 <!-- Standard animations for a non-full-screen window or activity. -->
    <style name="Animation.Dialog">
        <item name="windowEnterAnimation">@anim/dialog_enter</item>
        <item name="windowExitAnimation">@anim/dialog_exit</item>
    </style>