ListView控件不是扩大内NestedScrollView [英] ListView s not expanding inside NestedScrollView
问题描述
现在用的协调布局在我的活动页面。在这下面有应用栏的ListView。但其时,我使用的ListView代替NestedScrollView不工作。如果我把里面的ListView NestedScrollView,ListView控件不扩大
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
推荐答案
对于 CoordinatorLayout
正常工作所需的滚动孩子实施<一个href="https://developer.android.com/reference/android/support/v4/view/NestedScrollingChild.html">NestedScrollingChild.这样的类 NestedScrollView
和 RecyclerView
。
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屋!