xml - 无法解析类 SearchView

标签 xml searchview

所以当我遇到错误“无法解析类 SearchView”时,我试图在我的应用程序中包含一个搜索栏。谷歌没有帮助,所以我来到这里。这是我的代码:

<SearchView
        android:layout_width="410dp"
        android:layout_height="44dp"
        android:layout_marginEnd="1dp"
        android:layout_marginBottom="2dp"
        app:layout_constraintBottom_toTopOf="@+id/grid_view"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

其余的 xml 已正确完成,我直接从 android 获取小部件,所以这让我感到困惑。感谢所有帮助,谢谢。

最佳答案

可能需要指定SearchView for android组件的完整路径。

<android.widget.SearchView
    android:layout_width="410dp"
    android:layout_height="44dp"
    android:layout_marginEnd="1dp"
    android:layout_marginBottom="2dp"
    app:layout_constraintBottom_toTopOf="@+id/grid_view"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

关于xml - 无法解析类 SearchView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71114505/

相关文章:

python - xmlschema 元素不是架构的元素

java - 如何应用 utf-8 字符集编码将 DOM 文档对象转换为 xml

java - 在 SearchView.onQueryTextSubmit() 和 AsyncTask 上更新 ListView

android - SearchView 在同一 Activity 中执行搜索

java - 无法让 android.support.v7.widget.SearchView 接受文本

c# - C#中如何向字典中添加数据

xml - 在 PIG 中使用 xpath 提取 XML 中的属性值

android - FloatingActionButton渲染: Color value '?attr/colorAccent' must start with #

android - android studio 中可搜索的SearchView setSuggestionsAdapter()

java - RecyclerView 搜索过滤器过滤结果后位置错误