I got a RecyclerView whose element contains a EditText widget.
1.currently focusing on the second EditText,the first EditText is partly showed on the screen. the first EditText is partly showed
2.when click the first EditText, it got focus, then RecyclerView would automatically scroll down to fully show the first EditText. RecyclerView automatically scroll down when first EditText got focused
This is great,but what I want is RecyclerView should not automatically scroll. Any solution? thanks!
Actually, there is a scroll state of RecycleView that you can control like this;
Create your own LayoutManager and override the
scrollHorizontallyBy
like this.So, what is the
SCROLL_STATE_SETTLING
?I finally fixed it by disable the RecyclerView from scrolling except it receive a touch event.
first, I custom a LayoutManager:
when receive click event : I set horizontal and vertical to false ,these cause RecyclerView cannot scroll any more!
and I subClass The recyclerView and Override onTouchEvent:
so MyRecyclerView cannot scroll when click to find that the focus child is an EditText. But it can scroll when Receive Touch Event!