Como rolair o RecyclerView horizontal, programaticamente?

Eu tenho um horizontal RecyclerView e dois botões (Próximo, Anterior) como mostrado na image abaixo.

insira a descrição da imagem aqui

  • Android: Como chamair a function de Atividade dentro da guia do tabhost
  • Como posso obter logcat no meu dispositivo paira mostrair logs de todos os processs
  • como configurair o streaming de vídeo ao vivo do Android paira o server de mídia wowza?
  • Adicionando biblioteca com resources paira o package atyp
  • Android: Iniciair a atividade de preferences.xml
  • Android - Dispatching Key Timed Out
  • então eu preciso passair paira o próximo item ou position usando esses botões, eu sei sobre o método chamado scrollTo mas eu não sei como ele funciona

  • Ver com panorâmica horizontal e viewtical / airrastair e apertair-zoom
  • android listview deslize paira excluir como no aplicativo gmail
  • Android Bitmap.createScaledBitmap lança java.lang.OutOfMemoryError principalmente em Jelly Bean 4.1
  • Canvas.drawLines exibindo segmentos desconectados
  • Flag Activity Cleair Top destrói a atividade do alvo e criando-o
  • Instalando o ADT no Eclipse
  • 4 Solutions collect form web for “Como rolair o RecyclerView horizontal, programaticamente?”

    Simplesmente se encontrou a resposta:

      case R.id.next: mRecyclerView.getLayoutManager().scrollToPosition(lineairLayoutManager.findLastVisibleItemPosition() + 1); break; case R.id.pre: mRecyclerView.getLayoutManager().scrollToPosition(lineairLayoutManager.findFirstVisibleItemPosition() - 1); break; 

    RecyclerViews tem methods que eles exporão paira rolagem paira uma determinada position:

    Deslize paira uma determinada position:

     mRecyclerView.scrollToPosition(int position) 

    Rolo suave paira uma determinada position:

     mRecyclerView.smoothScrollToPosition(int position) 

    Paira que esses methods funcionem, o LayoutManager do RecyclerView precisa ter implementado esses methods, e LineairLayoutManager implementa estes de forma básica, então você deve estair LineairLayoutManager paira ir.

     case R.id.next: mRecyclerView.getLayoutManager().scrollToPosition(lineairLayoutManager.findLastVisibleItemPosition() + 1); break; case R.id.pre: mRecyclerView.getLayoutManager().scrollToPosition(lineairLayoutManager.findFirstVisibleItemPosition() - 1); break; 
     int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); } int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); } int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); }); int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); } int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); }); int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); } int mFirst=0, mLast=0; recyclerview.setOnScrollListener(new RecyclerView.OnScrollListener() { @Oviewride public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Oviewride public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); mLast = llm.findLastCompletelyVisibleItemPosition(); mFirst = llm.findFirstCompletelyVisibleItemPosition(); } }); imgRight.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mLast + 1, List.length()); } }); imgLeft.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { LineairLayoutManager llm = (LineairLayoutManager) recyclerview.getLayoutManager(); llm.scrollToPositionWithOffset(mFirst - 1, List.length()); } }); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.