修复可搜索配置xml文件中的构建路径错误

时间:2015-05-11 11:57:28

标签: android xml searchview

我尝试使用android studio将searchview添加到我的Android应用程序中,但是当我第一次添加searchable.xml配置文件时,我收到此错误

the fallowing classes could not be found: -searchable (fix build path,edit xml) and layout missing attributes

当我构建项目时,我收到此错误: -no resource found that matches the given name(at 'resource' with value @searchable.xml) -execution failed for task ':app.processDebugProcess'

任何帮助??

enter code here<?xml version="1.0" encoding="utf-8"?>

android:label="@string/search_label"
android:hint="@string/hint_search"
 />

1 个答案:

答案 0 :(得分:2)

searchable.xml 文件应位于 res / xml 文件夹中,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:hint="@string/hint_search"
    android:label="@string/search_label" >
</searchable>