ddfra
ddfra

Reputation: 2565

Cannot find "Theme.Material" in android studio

When I create a new Project in Android Studio, the dafault app theme is "Theme.appCompat.light". Whene I try to set "Theme.Material" as theme in the manifest Android Studio shows me no suggestion, and finds no "Theme.Material". I updated everything in the sdk manager. What have I to do to use Material Theme?

Upvotes: 3

Views: 5161

Answers (4)

perfectminimalist
perfectminimalist

Reputation: 131

Also if you have API version below 21 in the AS editor, the material dark and light theme sections will be empty in the select theme window that pops up when trying to change theme for a specific layout.

Upvotes: 0

IsaiahJ
IsaiahJ

Reputation: 454

It won't show up if you just use @style/Theme.Material like with how you'd normally use @style/Theme.AppCompat.

Theme.Material requires you to use @android:style/Theme.Material.

Upvotes: 3

bluesummers
bluesummers

Reputation: 12627

To be able to use all of Theme.Material you should:

  1. Make sure compileSdkVersion is set to at least 21.
  2. Make sure that in your dependencies you have compile 'com.android.support:design:24.0.0'

Both of these can be found on your build.gradle (Module: app) file.

After that you can apply Material Theme simply by going to your AndroidManifest.xml file and inside <application> tag make sure you have a line that says android:theme="@android:style/Theme.Material.Light".

Upvotes: 6

CommonsWare
CommonsWare

Reputation: 1007296

Your compileSdkVersion in the android closure needs to be 21 or higher to reference Theme.Material.

Upvotes: 0

Related Questions