Mike
Mike

Reputation: 6839

trying to implement toolbar in android

I am trying to get rid of my actiobars and use toolbar to update my app. I am not making my apps for 5.0 yet, so no other material goodness.

From following another post I made my themes.xml look like this:

<style name="AppTheme.Base" parent="Theme.AppCompat">
    <item name="colorPrimary">@color/mycolorprimary</item>
    <item name="colorPrimaryDark">@color/mycolorprimarydark</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
</style>

The first issue I am having is that "Style" is throwing this error:

Element Style must be declared

Upvotes: 0

Views: 92

Answers (1)

Kushal Sharma
Kushal Sharma

Reputation: 5973

Theme vs Style

So what exactly is the difference? Well they are both declared in exactly the same way (which you already know), the difference comes in how they’re used.

Themes are meant to be the global source of styling for your app. The new functionality doesn’t change that, it just allows you to tweak it per view.

Styles are meant to be applied at a view level. Internally, when you set style on a View, the LayoutInflater will read the style and apply it to the AttributeSet before any explicit attributes (this allows you to override style values on a view).

Values in an attribute set can reference values from the View’s theme.

Themes are global, styles are local.

From theme-vs-style

I would recomend a read at the above link.

Upvotes: 1

Related Questions