简体   繁体   English

在android studio中找不到“Theme.Material”

[英]Cannot find “Theme.Material” in android studio

When I create a new Project in Android Studio, the dafault app theme is "Theme.appCompat.light".当我在 Android Studio 中创建一个新项目时,dafault 应用程序主题是“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".当我尝试在清单中将“Theme.Material”设置为主题时,Android Studio 没有显示任何建议,也没有找到“Theme.Material”。 I updated everything in the sdk manager.我更新了 SDK 管理器中的所有内容。 What have I to do to use Material Theme?我需要做什么才能使用 Material Theme?

To be able to use all of Theme.Material you should:为了能够使用所有Theme.Material您应该:

  1. Make sure compileSdkVersion is set to at least 21.确保compileSdkVersion至少设置为 21。
  2. Make sure that in your dependencies you have compile 'com.android.support:design:24.0.0'确保在您的dependencies您已compile 'com.android.support:design:24.0.0'

Both of these can be found on your build.gradle (Module: app) file.这两个都可以在你的build.gradle (Module: app)文件中找到。

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" .之后,您只需转到您的AndroidManifest.xml文件并在<application>标签内确保您有一行显示android:theme="@android:style/Theme.Material.Light"即可应用 Material Theme。

It won't show up if you just use @style/Theme.Material like with how you'd normally use @style/Theme.AppCompat .它不会显示出来,如果你只需要使用@style/Theme.Material像如何你通常使用@style/Theme.AppCompat

Theme.Material requires you to use @android:style/Theme.Material . Theme.Material要求您使用@android:style/Theme.Material

您在android闭包中的compileSdkVersion需要为 21 或更高才能引用Theme.Material

此外,如果 AS 编辑器中的 API 版本低于 21,则在尝试更改特定布局的主题时弹出的选择主题窗口中,材质深色和浅色主题部分将为空。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 看不到Theme.Material或Android L的东西 - cannot see Theme.Material or Android L's things Android L Theme.Material无法识别 - Android L Theme.Material not being recognized Android Studio 1.3:Theme.Material.Light和Theme.Material提供错误 - Android Studio 1.3: Theme.Material.Light and Theme.Material Giving Error 带有Theme.Material的Android设计支持库 - Android design support library with Theme.Material Android 中的 Theme.AppCompat 和 Theme.Material 有什么区别? - What is the difference between Theme.AppCompat and Theme.Material in Android? 错误:获取AppCompatActivity与android:Theme.Material不兼容 - Error: Getting AppCompatActivity is not compatible with android:Theme.Material 找不到与给定名称“android:Theme.Material”匹配的资源 - No resource found that matches the given name 'android:Theme.Material' 如何同时使用android:Theme.Material和工具栏? - How to use android:Theme.Material and Toolbar together? 如何在styles.xml android中使用android:Theme.Material(Material theme)? - How to use android:Theme.Material (Material theme) in styles.xml android? 无法将ActionBarActivity与Theme.Material一起使用 - Can't use ActionBarActivity with Theme.Material
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM