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" />

https://stackoverflow.com/questions/71114505/

相关文章:

python - 两个日期时间之间的 15 分钟间隔数

python - 如何在不完全用 Python 重写的情况下在函数内部添加、删除和编辑某些行?

python - 文档字符串应该放在装饰器之前还是之后?

c++ - 将全局引用计数资源与原子同步——在这里放宽合适吗?

javascript - react-bootstrap-table-toolkit 搜索导入报错

python - 我们如何提取数据框中具有顺序值的行?

arrays - Perl 中是否有任何函数可以移动数组元素而不删除它们?

javascript - 使用 useState 从数组中删除最后一项

python - 理解 python 的 len() 时间复杂度

docker - 如何通过 SSH 进入 colima 实例