【发布时间】:2016-06-03 21:23:38
【问题描述】:
我已将我的应用更新为 23 SDK 和 Android Studio。 现在我的主屏幕小部件在升级到新版本时消失了。 我调查了日志并看到了这个警告:
W/AppWidgetHostView: Error inflating AppWidget AppWidgetProviderInfo(provider=ComponentInfo{*********/**********}): android.view.InflateException: Binary XML file line #17: Error inflating class android.support.v7.widget.ActionMenuView
但我没有在我的小部件布局中使用 ActionMenuView。而且我不知道如何在小部件中使用它。
应用升级后,我可以再次添加小部件,一切看起来都不错。 我以前没有遇到过这样的小部件问题。
- minSdkVersion 7
- targetSdkVersion 23
- 编译SdkVersion 23
- buildToolsVersion "23.0.2"
- com.android.support:appcompat-v7:23.1.0
更新:
我发现仅在 abc_action_menu_layout.xml 中使用的 ActionMenuView 是从 compat 库中分解出来的:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.ActionMenuView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:divider="?attr/actionBarDivider"
app:dividerPadding="12dip"
android:gravity="center_vertical"/>
但我不明白为什么主屏幕小部件需要它。
【问题讨论】:
-
你应该把解决方案作为你自己的答案,并接受它。在 SO 中完全有效
-
非常感谢!