ListView在NestedScrollView内部未扩展 [英] ListView not expanding inside NestedScrollView

查看:77
本文介绍了ListView在NestedScrollView内部未扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在活动页面中使用了CoordinatorLayout.在应用栏下方是ListView.但是当我使用ListView而不是NestedScrollView时它不起作用.如果我将ListView放在NestedScrollView内,则ListView不会扩展

I am using CoordinatorLayout 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

推荐答案

要使CoordinatorLayout正常运行,您需要滚动子项来实现

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

简而言之-只需使用RecyclerView作为滚动内容,它将可以正常工作:)

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

P.S.顺便提一句,我不知道您为什么要使用ListView的原因.我知道这是一种习惯,并且设置起来比较容易(因为您已经做过很多次了),但是无论如何还是建议使用RecyclerView.

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.

这篇关于ListView在NestedScrollView内部未扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆