开发者

Extending styles and themes confusion

In my manifest I used to have something like this

<activity android:name=".MyActivity"
     android:label="@string/app_name"
        name="Theme.NoTitleBar"...

and it worked great, I mean the title bar was not shown.

But now I want to customize the theme (I want to extend the default android theme) and I created this theme

<style name="Theme.NoTitleBar.new_skin" parent="android:Theme">
        <item name="text_body_read">@style/text_body_read</item>
        <item name="text_body_unread">@style/text_body_unread</item>
    </style>

then in the manifest I set name="Theme.NoTitleBar.new_skin", but the title bar is still shown.

how can I hide the title bar 开发者_开发百科and still have my new custom theme ?

and one more question does adding dots '.' means extending when working with styles ?


in your mainfest you should write something like:

<activity android:name=".MyActivity"
     android:label="@string/app_name"
        name="MyTheme"...

In your styles.xml you should write something like:

<style name="MyTheme" parent="android:Theme.NoTitleBar">
        <item name="text_body_read">@style/text_body_read</item>
        <item name="text_body_unread">@style/text_body_unread</item>
 </style>

Dot (.) doesn't mean extending. It means referencing a certain element (listview, textview etc.) in your theme. For example, you would have:

<style name="MyTheme.Widget.ListView" parent="@android:style/Widget.ListView.White">
</style>

to define style of your listview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜