Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 981
Lukap Avatar asked Nov 05 '22 13:11

Lukap


1 Answers

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.

like image 106
Maggie Avatar answered Nov 09 '22 09:11

Maggie