【问题标题】:Fix build path error in searchable configuration xml file修复可搜索配置 xml 文件中的构建路径错误
【发布时间】:2015-05-11 11:57:28
【问题描述】:

我正在尝试使用 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"
 />

【问题讨论】:

  • labelnamehinttext 保留在 string.xml 文件中
  • 已经写在 sting.xml 文件上

标签: android xml searchview


【解决方案1】:

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>

【讨论】:

  • 您需要手动创建。 Android 默认不创建它。
  • 只有所有xml接口所在的layout文件夹
  • 是的,在 res 文件夹中还有很多其他内容,例如可绘制、布局、菜单、值等。您需要在该 res 文件夹中创建一个名为 xml 的新文件夹。
  • 我假设您使用的是 Android Studio。右键单击 res 文件夹。选择新建,然后选择目录。在出现的对话框中,介绍您要创建的文件夹的名称。在这种情况下,xml。你完成了。现在您需要将 searchable.xml 文件放入该文件夹中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-01
  • 1970-01-01
相关资源
最近更新 更多