Как добавить динамический поиск вводимой информации

Рейтинг: 0Ответов: 0Опубликовано: 04.03.2023

Добавил в свой макет данный код, теперь не могу понять как добавить поиск по тексту который ввел пользователь. В интернете везде пользуются обычными виджетами SearchView. Почему нигде нет информации по виджетам Matrial Design 3 ?

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/coordinator"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/listText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="80dp"
        app:layout_behavior="@string/searchbar_scrolling_view_behavior"/>
    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <com.google.android.material.search.SearchBar
            android:id="@+id/search_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Нажмите для поиска" />
    </com.google.android.material.appbar.AppBarLayout>

    <com.google.android.material.search.SearchView
        android:id="@+id/search_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:hint="Введите текст поиска"
        app:layout_anchor="@id/search_bar">
        <!-- Search suggestions/results go here (ScrollView, RecyclerView, etc.). -->
    </com.google.android.material.search.SearchView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Думаю с помощью этого кода это как то делается ?

binding.searchView.addTransitionListener(
            (searchView, previousState, newState) -> {
                if (newState == SearchView.TransitionState.SHOWING) {

                }
            });

Ответы

Ответов пока нет.