如何知道如果一个RecyclerView有足够的内容滚动? [英] How to know if a RecyclerView has enough content to scroll?

查看:143
本文介绍了如何知道如果一个RecyclerView有足够的内容滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我使用一个的LinearLayout管理器和一个EditText作为一个HeaderView为RecyclerView过滤列表中的内容。

Currently I am using a RecyclerView with a LinearLayout Manager and an EditText as HeaderView for filtering the content of the list.

我想隐藏的EditText如果RecyclerView的含量比RecyclerView本身较小。

I would like to hide the EditText if the content of the RecyclerView is smaller than the RecyclerView itself.

有什么办法来问的Recyclerview或LayoutManager的,如果它的内容可以滚动?

Is there any way to "ask" the Recyclerview or the LayoutManager if its content can scroll?

感谢大家。

推荐答案

RecyclerView 当最后一个位置的项目是完全可见的不能再滚动。

RecyclerView can't scroll anymore when the item at last position is completely visible.

在条件听起来就像:

mRecyclerView.getLayoutManager().findLastCompletelyVisibleItemPosition() == mRecyclerViewAdapter.getItemCount() - 1;

这篇关于如何知道如果一个RecyclerView有足够的内容滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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