Currently I am using a RecyclerView with a LinearLayout Manager and an EditText as HeaderView for filtering the content of the list.
I would like to hide the EditText if
An answer that also accounts for dynamic screen sizes.
mRecyclerView.getViewTreeObserver().addOnScrollChangedListener(() -> {
if (mRecyclerView.canScrollVertically(1) && //still scrolling
mRecyclerView.computeVerticalScrollRange() >= mRecyclerView.getHeight()) { //Big enough for scrolling
return; //we still scrolling so early out.
}
DoMyFunction();
}
do you mean this:
https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.html#canScrollVertically()
if(recyclerView.getLayoutManager().canScrollVertically()){
// do stuff
} else{
// do other stuff
}
RecyclerView
can't scroll anymore when the item at last position is completely visible.
In condition that would sound as:
mRecyclerView.getLayoutManager().findLastCompletelyVisibleItemPosition() == mRecyclerViewAdapter.getItemCount() - 1;