I'm trying to implement a Screen that has a material SearchBar.
I followed this documentation: https://developer.android.com/reference/com/google/android/material/search/SearchBar
but I'm getting a warning over this line
app:layout_behavior="@string/searchbar_scrolling_view_behavior" that's telling me searchbar_scrolling_view_behavior is marked as private in material:1.8.0 lib.
But the Material Components Doc. tells me that SearchBar is available starting from 1.8.0-alpha03 - link here
So when I'm using the app:layout_behavior="@string/searchbar_scrolling_view_behavior" then my RecyclerView gets placed behind the SearchBar like in the image bellow:
And when I change it to app:layout_behavior="@string/appbar_scrolling_view_behavior" I get the right positioning of my RecyclerView but my SearchBar doesn't look as it should anymore.
How can I have a proper positioning of my RecyclerView and a normal display of SearchBar at the same time?


Was able to find a workaround on this by replacing
CoordinatorLayoutwithConstraintLayoutand instead of hooking thesearchViewto thesearchBarby using:app:layout_anchor="@id/search_bar"I've hooked them programmatically by calling:searchView.setupWithSearchBar(searchBar)When I'm initializing the
viewswithin myFragmentclass.