spi*_*ce7 48 android android-appcompat android-toolbar
自从升级到最新的appcompat库以来,我在ViewUtils的日志中看到了一条消息.
app:theme is now deprecated. Please move to using android:theme instead.
我parent="Theme.AppCompat.Light.NoActionBar"用作我的主题父母.
ade*_*dek 70
替换app:theme为android:theme但您可以在不使用时出现这种情况app:theme.检查您的布局,尤其是工具栏布局.在我的情况下,我没有app:theme在我的布局文件中.然后看看我的情况:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:styled="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
styled:popupTheme="@style/ToolbarDarkPopup"
styled:theme="@style/ActionBarThemeOverlay" />
Run Code Online (Sandbox Code Playgroud)
我已将此布局更改为:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ActionBarThemeOverlay" />
Run Code Online (Sandbox Code Playgroud)
现在我没有看到警告.
看看这里:https: //chris.banes.me/2015/04/22/support-libraries-v22-1-0/
Chris Banes的精彩解释
Gre*_*nis 18
我有另一个案例,当我Toolbar在styles.xml中设置样式时发生这种情况.它看起来像这样:
<style name="AppActionBar" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/ng_blue</item>
<item name="theme">@style/ThemeOverlay.AppActionBar</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
</style>
Run Code Online (Sandbox Code Playgroud)
更改name="theme"到name="android:theme"它解决了这一问题.
| 归档时间: |
|
| 查看次数: |
15463 次 |
| 最近记录: |