首页 > 解决方案 > MaterialSearchView 不显示重新发送列表

问题描述

我使用MaterialSearchView。这是我的布局。我也使用导航组件。从 toolBar mainActivity 必须在 Fragments 中显示 MaterialSearchView

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:title="@null">

        <com.miguelcatalan.materialsearchview.MaterialSearchView
            android:id="@+id/search_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </androidx.appcompat.widget.Toolbar>

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/myNavHostFragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:navGraph="@navigation/navigation" />

</LinearLayout>
当我在搜索中写入时,重新发送列表显示如下:

谢谢! 怨恨

标签: androidandroid-layoutandroid-fragmentssearchsearchview

解决方案


推荐阅读