无法使用Material Theme

时间:2015-10-07 17:50:35

标签: android material-design

我的第一个使用Material Design的应用程序,所以我尝试使用Material Theme,但不能使用它。当我输入collapse下划线的红色时。

即使我的SDK是21,所以无法理解为什么我无法使用它。

@android:style/Theme.Material.Light

非常感谢任何帮助

2 个答案:

答案 0 :(得分:1)

为了支持较旧的SDK版本,您可以使用支持存储库中的AppCompat库。

在themes.xml文件中,您可以执行以下操作:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="AppTheme.Base" />

     <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
       <!-- Customize your theme here. -->
       <item name="colorPrimary">@color/colorPrimary</item>
       <item name="colorPrimaryDark">@color/colorPrimaryDark</item>

       <item name="windowActionBar">false</item>
       <item name="android:windowNoTitle">true</item>

    </style>

</resources>

然后您可以在AndroidManifest.xml文件中简单地引用此主题。

我希望这可以帮到你!

答案 1 :(得分:0)

您将minSDKVersion设置为17.

Support Library让你在使用旧版Android的设备上起诉添加到android中的新功能。你应该研究它(特别是v7,因为那与材料设计有关)!