android - 应用程序 :theme now is deprecated

标签 android styles themes android-appcompat

我从昨天开始就很好地使用 android 但今天当我通过 intellijIDEA 运行我的应用程序时它给了我:

I/AppCompatViewInflater﹕ app:theme is now deprecated. Please move to using android:theme instead.

我的风格是:

    <resources>

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

    </style>

    <style name="Theme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android: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>
</resources>

问题是什么,我该如何解决?

提前致谢,

更新:我的toolbar.xml 文件是:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
                               xmlns:local="http://schemas.android.com/apk/res-auto"
                               android:id="@+id/toolbar"
                               android:layout_width="match_parent"
                               android:layout_height="wrap_content"
                               android:minHeight="?attr/actionBarSize"
                               android:background="?attr/colorPrimary"
                               local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                               local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

android SDK 工具:24.3.3

android sdk 构建工具:22

android 支持库:22.2

最佳答案

尝试

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 
           xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:local="http://schemas.android.com/apk/res-auto"
           android:id="@+id/toolbar"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:minHeight="?attr/actionBarSize"
           android:background="?attr/colorPrimary"
           android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
          />

关于android - 应用程序 :theme now is deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31356829/

相关文章:

带有箭头样式的 WPF 弹出窗口

WPF Styles - 请帮助我理解为什么它会这样工作

c# - 如何使主题选择器在应用程序范围内应用更改

android - 如何使用 Dagger2 提供上下文

java - TextView的宽度,动态包裹到ImageView的宽度中

android - map 工具栏始终以 liteMode 显示

Android 工具栏样式

任务 ':app:packageAllDebugClassesForMultiDex' 的 Android Studio 执行失败

gedit中c结构的自定义文本颜色

ios - 任何获取iOS系统默认主题颜色的方法