Skip to content
Advertisement

RecyclerView Search FIlter results are below the Toolbar

This might be a stupid question that I’ve tried very hard to find the answer with no success. I have a fragment that contains a recyclerView. The fragment is in the mainActivity which contains my custom toolbar and a bottonNavigationMenu. I’ve also made a search filter view for the recyclerView that works. The problem is this: When I hit on the search for the recyclerView the first 2 results are below the Toolbar, thus not visible to the user. I had this problem with recyclerView (even when not using the search filter) and fixed it using the margins. But I don’t know how to fix this one, so if you could help me out I’d really appreciate it.

Note: the search filter works just fine, I used prints to test it, it’s just that the 2 first results are below the toolbar and not visible.

Fragment’s xml:

JavaScript

RecyclerViewItem xml:

JavaScript

SearchFilter’s xml:

JavaScript

MainActivity xml:

JavaScript

The search results I get-> [1]: https://i.stack.imgur.com/DmyIk.png

Advertisement

Answer

The problem is the constraint that have FragmentContainerView and BottomNavigationView .

Here’s convenient that BottomNavigationView have a fixed size.

And FragmentContainerView set limit to top with @+id/appBarLayout2 and limit to bottom with @+id/bottomNavigationView.

The MainActivity xml would be:

JavaScript
Advertisement