Hello, I have a problem that when adding data it sends me to the start of the recycler when in reality what I want is for it to stay in the current position. This happens every time the user fills in the end of the footer and reloads more data from volley ..
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
the method that detects that it has reached the end
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (!recyclerView.canScrollVertically(0)) {
CargarContenido();
}
}
});
I suppose that what you are trying is something similar to the messages in a chat, when a new one arrives, it stays in the position of the last one.
Try
mensajes.scrollToPosition(adaptador.getItemCount()-1);
in the Activity where you load the elements of your Recycler.