I'd like to add a custom time picker to my application.
There is recycle view with fixed size that allowed only three items (lines) at time. When I scroll it - it scrolls smoothly thus I fix position of element by this code:
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
int f = layout.findFirstVisibleItemPosition();
layout.scrollToPosition(f);
adapter.setCurrentPosition(f + 1);
}
It say to the LinearLayout find the first visible element and scroll to it. Thus I have it as first line, then selected time value as second line. The third line we can see because of the height of the RecycleView same item height * 3.
I think it too complex. Is there some Layout parameter or some other Layout that can provide scroll line by line?