Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
How to get offset for RecyclerView?

I want to save the position of my RecyclerView, then reset it later. If the top item is only halfway visible, what do I use to save this offset?

For the position I am using: findFirstCompletelyVisibleItemPosition()

To reset the position I am using:

        ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, offset);

But I am not sure what to pass as the offset?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You must use LinearLayoutManager as this..

LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager();
int position = manager.findFirstVisibleItemPosition();
View firstItemView = manager.findViewByPosition(position);
float Offset = firstItemView.getTop();

And get the position and offset of first item in current window.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda