chathura
chathura

Reputation: 3452

Android Themes and styles.xml

(1) I am confused with the themes in android.

For example android:Theme.Material.Light and Theme.AppCompat.Light. Also Holo light and dark themes.

I don't understand when to use what. Can someone explain me the differences of these android themes?

Need a good explanation about these themes so that I can understand how this works in my style.xml.

(2) why there are prefixed and non prefixed attributes in style tags.

 <item name="colorPrimary">#3F51B5</item>
 <item name="android:colorPrimary">#3F51B5</item>

when to use prefix?

Can someone explain this?

Upvotes: 1

Views: 530

Answers (1)

Alan S.
Alan S.

Reputation: 156

The important thing to note about these themes is that not every version of Android will support them. Thus, you may want to use different themes depending on which version of Android your application gets installed on. Derek Banas had a great video on styles and themes:

https://www.youtube.com/watch?v=W3xHIN15hP8

I'm not the most knowledgeable about styles, but I'll give it a shot. I believe that "android:colorPrimary" is used when you are overriding an attribute in an already defined style. I'm not the most knowledgeable about styles so I will lead you to the documentation page that I found that seems to cover this topic fairly well:

http://developer.android.com/guide/topics/ui/themes.html

Here are some references for further reading

https://plus.google.com/+AndroidDevelopers/posts/JXHKyhsWHAH

https://plus.google.com/+AndroidDevelopers/posts/AV2ooBWY1iy

Upvotes: 1

Related Questions