简体   繁体   English

Android Studio 1.3:Theme.Material.Light和Theme.Material提供错误

[英]Android Studio 1.3: Theme.Material.Light and Theme.Material Giving Error

I am trying to make an Android Application with Material Design. 我正在尝试使用Material Design开发一个Android应用程序。 My initial problem was that the v22 styles.xml wasn't present in the values folder. 我最初的问题是,values文件夹中没有v22 styles.xml。 However, I fixed that issue with the following link from Stackoverflow: 但是,我通过Stackoverflow的以下链接修复了该问题:

values-21, values-22 or values-xx folder is gone after Android Studio 1.0 在Android Studio 1.0之后不再显示values-21,values-22或values-xx文件夹

Then, when I changed my new v22 styles.xml theme to Theme.Material.Light, it showed an error and appeared red. 然后,当我将新的v22 styles.xml主题更改为Theme.Material.Light时,它显示了错误并显示为红色。 In the above link, bijang tells Pankaj to download and put a certain themes_material.xml file into the values folder. 在上面的链接中,bijang告诉Pankaj下载并将特定的themes_material.xml文件放入values文件夹中。 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.Light错误消失了,但是在该文件中(其源代码可以在这里找到: https ://gist.github.com/jbj88817/b0a3f750e3fe705a8a1a)它显示如下错误:

Theme.Material, where THEME is the error. Theme.Material,其中THEME是错误。 Please help! 请帮忙!

Here is my v22 styles.xml: 这是我的v22 styles.xml:

<resources>
     <style name="AppTheme" parent = "Theme.Material.Light">
     </style>
</resources>

Since after the SDK for api 22 was introduced. 自从引入api 22 SDK之后。 You don't need a separate styles.xml for v22 or v21. 对于v22或v21,您不需要单独的styles.xml。 So in values res folder have only one styles.xml(default one) and to support material design use Theme.AppCompat. 因此,在values文件夹中,res文件夹仅包含一个styles.xml(默认值为一个),并且要使用Material.AppCompat支持材质设计。

Example

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

</style>

And in addition use AppCompatActivity instead of ActionBarActivity for your activity. 另外,对于您的活动,请使用AppCompatActivity而不是ActionBarActivity

Example

public class MainActivity extends AppCompatActivity

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

相关问题 @@ android:style / Theme.Material.Light的Android错误 - Android error for `@android:style/Theme.Material.Light` 在android studio中找不到“Theme.Material” - Cannot find “Theme.Material” in android studio DrawerLayout,NavigationView和android:Theme.Material.Light不兼容? - DrawerLayout, NavigationView, and android:Theme.Material.Light not compatible? 检索项目的父项时出错:找不到与给定名称“android:Theme.Material.Light”匹配的资源 - Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light' Android L Theme.Material无法识别 - Android L Theme.Material not being recognized 错误:获取AppCompatActivity与android:Theme.Material不兼容 - Error: Getting AppCompatActivity is not compatible with android:Theme.Material 带有Theme.Material的Android设计支持库 - Android design support library with Theme.Material android:Theme.Material.Light 需要 API 级别 21(当前最小值为 8) - android:Theme.Material.Light requires API level 21 (current min is 8) Android Studio 添加主题材质灯获取错误缺少样式 - Android Studio adding theme material light getting error missing style Android 中的 Theme.AppCompat 和 Theme.Material 有什么区别? - What is the difference between Theme.AppCompat and Theme.Material in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM