1

I am trying to make an Android Application with Material Design. My initial problem was that the v22 styles.xml wasn't present in the values folder. However, I fixed that issue with the following link from Stackoverflow:

values-21, values-22 or values-xx folder is gone after Android Studio 1.0

Then, when I changed my new v22 styles.xml theme to Theme.Material.Light, it showed an error and appeared red. In the above link, bijang tells Pankaj to download and put a certain themes_material.xml file into the values folder. The existing Theme.Material.Light error goes away, but in that file (whose source code can be found here: https://gist.github.com/jbj88817/b0a3f750e3fe705a8a1a) It shows an error as follows:

Theme.Material, where THEME is the error. Please help!

Here is my v22 styles.xml:

<resources>
     <style name="AppTheme" parent = "Theme.Material.Light">
     </style>
</resources>
Community
  • 1
  • 1
Nexus
  • 85
  • 8
  • Add your styles.xml in your question and what is your compile sdk version?? – Aawaz Gyawali Aug 08 '15 at 02:27
  • My styles.xml is the default styles.xml with pretty much nothing in it. and my compile sdk version is 22 – Nexus Aug 08 '15 at 03:24
  • Use Theme.AppCompat as parent theme in your styles.xml. Since your compile sdk version is 22 you don't need a separate styles.xml for for 22 or 21 api. And don't forget to use AppCompatActivity instead of ActionBarActivity(Deprecated). Hope this helps you. Let me know of it. – Aawaz Gyawali Aug 08 '15 at 03:27
  • Is Theme.AppCompat Material Design? And also, can you explain the AppCompatActivity and the ActionBarActivity(Deprecated)? – Nexus Aug 08 '15 at 03:59
  • Literally yes, Theme.AppCompat is Material design. Actually Material design was introduced for api 21 is 5.0 so to support the material design on pre-lopipop google released AppCompat. There is lot more about AppCompat in SO and google docs. You can have a look on them. See [here](http://stackoverflow.com/questions/29797172/whats-the-enhancement-of-appcompatactivity-over-actionbaractivity) for AppCompatActivity – Aawaz Gyawali Aug 08 '15 at 04:02
  • So the default theme in styles.xml is Theme.AppCompat.Light.DarkActionBar. Should I just change it to Theme.AppCompat.Light, considering that I want to use a different color for the action bar? – Nexus Aug 08 '15 at 04:08
  • Ask a different question or search for this. Customizing the theme has a lot more thing. – Aawaz Gyawali Aug 08 '15 at 04:11

1 Answers1

0

Since after the SDK for api 22 was introduced. You don't need a separate styles.xml for v22 or v21. So in values res folder have only one styles.xml(default one) and to support material design use Theme.AppCompat.

Example

<style name="AppTheme" parent="Theme.AppCompat">

</style>

And in addition use AppCompatActivity instead of ActionBarActivity for your activity.

Example

public class MainActivity extends AppCompatActivity
Aawaz Gyawali
  • 3,244
  • 5
  • 28
  • 48