Reputation:
I am learn about how to apply theme in app.
<style name="Theme.BaseApp" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimary">@color/colorPrimary</item>
</style>
When we use android:colorPrimary
line.
Please help me.
Upvotes: 0
Views: 1133
Reputation: 1075
Here is complex answer for you
Here what you need:
Just get the idea and you ready to go.
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimaryDark"/>
Setup guide: http://antonioleiva.com/material-design-everywhere/
Source with example: https://github.com/antoniolg/MaterialEverywhere
To make Toolbar work lower API 11 use Theme.AppCompat.Light.NoActionBar (instead windowActionBar set to false)
<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
</style>
Here is Material Design Library for pretty buttons, etc.. Currently it's heavily developed.
Guide, code, example - https://github.com/navasmdc/MaterialDesignLibrary
Guide how to add library to Android Studio 1.0 - How do I import material design library to Android Studio?
.
Hope it helps :)
Upvotes: 0
Reputation: 987
I dont really know what are you asking for. You set @color/colorPrimary
in a separeate colors.xml file. Then after you assign your color to
<item name="android:colorPrimaryDark">@color/colorPrimary</item>
it will be automatically used for some things in the theme like notification bar etc
Example:
styles.xml
<style name="AppTheme" parent="android:Theme.Material.Light">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
</style>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#2196F3</color>
<color name="primary_dark">#0D47A1</color>
<color name="accent">#FF9800</color>
</resources>
You can then use those colors to keep consistent color palette over your app.
Upvotes: 1