博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

What is the relation of theme and it's derived theme.

Posted on 2014-07-17 14:27  haobo  阅读(137)  评论(0编辑  收藏  举报

You know, a theme can derive from other theme in two ways: xx.xxx implicit way and parent="xxx" explicit way.

But, what will hapen if we define a theme together with two ways. We demonstrate in the following code fragment:

    <style name="baseColor">
        <item name="android:textColor">#FF0000</item>
        <item name="android:textSize">40sp</item>
    </style>
    
    <style name="secondColor">
        <item name="android:textColor">#0080ff</item>
    </style>
    
    <style name="baseColor.text"  parent="secondColor">
    </style>

 

If you apply the style  "basecolo.text" to a TextView, you will find the fact that "baseColor.text" derived from "secondColor", no attr in "baseColor" is derived. That is, if both implicit and explicit way exist, explicit way work.

But, if you remove the parent sequence, the "baseColor.text" will derive from "baseColor", like following,  implicit way work.

<style name="baseColor.text">
</style>