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.
精彩评论