膨胀 androidx.appcompat.widget.SearchView 时出错

Jai*_*Jai 6 data-binding android kotlin inflate-exception searchview

我们在 Play 商店中收到有关 androidx.appcompat.widget.SearchView 膨胀异常的崩溃报告,在 OnCreateView 方法中我们以这种方式膨胀布局。

val binding = DataBindingUtil.inflate(inflater, R.layout.layout_class_groups, container, false)
Run Code Online (Sandbox Code Playgroud)

xml中的SearchView实现如下。

   <androidx.appcompat.widget.SearchView
            android:id="@+id/classGroupsSearchView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:theme="@style/SearchViewStyle"
            app:iconifiedByDefault="false" />
Run Code Online (Sandbox Code Playgroud)

我也为 SearchView 使用了自定义样式。

<style name="SearchViewStyle" parent="Widget.AppCompat.Light.SearchView">
    <item name="android:textSize">16sp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我们在测试时无法复制此崩溃,那么我该如何修复它呢?