无法解析符号 abc_ic_search_api_mtrl_alpha
Cannot resolve symbol abc_ic_search_api_mtrl_alpha
所以在我的项目中,我在操作栏中使用标准 material 搜索图标。
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/search"
android:title="@string/action_search"
android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
app:showAsAction="collapseActionView|ifRoom"
app:actionViewClass="android.support.v7.widget.SearchView" /> </menu>
但是如果我将库从 23.0.1 更新到 24.1.1 Android Studio 说:
Cannot resolve symbol abc_ic_search_api_mtrl_alpha
这是为什么?我在 google 中搜索但没有找到答案。
我在 Whosebug 上发现了一个类似的问题:error: cannot find symbol variable abc_ic_ab_back_mtrl_am_alpha
以上题目的答案是:
The name of the resource was changed in the 23.2.0 support library.
Modify abc_ic_ab_back_mtrl_am_alpha
to abc_ic_ab_back_material
Edit: In 23.2.1 the name of the component was changed back to
abc_ic_ab_back_mtrl_am_alpha
Edit: In 24.0.0 the name of the component was changed to:
abc_ic_ab_back_material
您只需将名称 abc_ic_search_api_mtrl_alpha
更改为 abc_ic_ab_search_material
它应该有效
更新
对于 API 版本 24.2.1 和更大的使用下面的关键字。
abc_ic_search_api_material
它会起作用。
您可以将 'back' 和 'search' material 图标导入为矢量绘图。
右键单击 res/drawable
-> New
-> vector asset
然后您可以使用 DrawableCompat.setTint() 自定义可绘制对象的颜色。这不仅更加灵活,而且在未来的支持库更新中也不会中断。
所以在我的项目中,我在操作栏中使用标准 material 搜索图标。
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/search"
android:title="@string/action_search"
android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
app:showAsAction="collapseActionView|ifRoom"
app:actionViewClass="android.support.v7.widget.SearchView" /> </menu>
但是如果我将库从 23.0.1 更新到 24.1.1 Android Studio 说:
Cannot resolve symbol abc_ic_search_api_mtrl_alpha
这是为什么?我在 google 中搜索但没有找到答案。
我在 Whosebug 上发现了一个类似的问题:error: cannot find symbol variable abc_ic_ab_back_mtrl_am_alpha
以上题目的答案是:
The name of the resource was changed in the 23.2.0 support library.
Modify
abc_ic_ab_back_mtrl_am_alpha
toabc_ic_ab_back_material
Edit: In 23.2.1 the name of the component was changed back to abc_ic_ab_back_mtrl_am_alpha
Edit: In 24.0.0 the name of the component was changed to: abc_ic_ab_back_material
您只需将名称 abc_ic_search_api_mtrl_alpha
更改为 abc_ic_ab_search_material
它应该有效
更新
对于 API 版本 24.2.1 和更大的使用下面的关键字。
abc_ic_search_api_material
它会起作用。
您可以将 'back' 和 'search' material 图标导入为矢量绘图。
右键单击 res/drawable
-> New
-> vector asset
然后您可以使用 DrawableCompat.setTint() 自定义可绘制对象的颜色。这不仅更加灵活,而且在未来的支持库更新中也不会中断。