在Android 5.0 Lollipop中没有找到资源实现Material Design的错误

时间:2015-12-08 09:18:21

标签: android android-5.0-lollipop material-design

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">
    </style>
    <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

遵循本教程:

http://www.androidhive.info/2015/04/android-getting-started-with-material-design/

我收到此错误:

error is #Error:(11, 5) No resource found that matches the given name: attr 'windowNoTitle'.
#Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\hamees\AppData\Local\Android\sdk3\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1

2 个答案:

答案 0 :(得分:0)

您使用的样式适用于较低版本。

API 21 及更高版本 -

<style name="MyMaterialTheme.Base"parent="Theme.AppCompat.Light.DarkActionBar">
 <item name="android:windowNoTitle">true</item>
 <item name="android:windowActionBar">false</item>
 <item name="android:colorPrimary">@color/colorPrimary</item>
 <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
 <item name="android:colorAccent">@color/colorAccent</item>
</style>

答案 1 :(得分:0)

试试这个:

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>