Bincy Baby Bincy Baby - 14 days ago 12
Android Question

ListView not expanding inside NestedScrollView

Am using Coordinator Layout in my activity page. In that there is ListView below the app bar. But its not working when i use ListView instead of NestedScrollView. And if i put ListView inside NestedScrollView, ListView is not expanding

Answer

For the CoordinatorLayout to work properly you need the scrolling child to implement NestedScrollingChild. Such classes are NestedScrollView and RecyclerView.

To say it short - just use a RecyclerView for your scrolling content and it'll work correctly :)

P.S. As a side note, I don't see a reason why you'd use a ListView anymore. I know it's a habit and it's easier to setup (because you've done it many times), but using a RecyclerView is the recommended way anyways.

Comments