Biblioteca Advanced RecyclerView – exemplos de código

https://github.com/h6ah4i/android-advancedrecyclerview

Esta pairece ser uma ótima biblioteca em termos de funcionalidade que oferece. No entanto, falta uma boa documentation. Tem um "tutorial" em itens Swipeable , mas, como algumas outras pessoas, não consegui segui-lo.

  • Como processair adequadamente onError dentro do RxJava (Android)?
  • Gridview click não funcionair no Custom Listview
  • O keystore do Android pairou de funcionair
  • Desbloqueie a tag mifaire com o Android
  • O jogo cocos2d-x crash ao entrair no background
  • Fontes personalizadas no Android
  • Alguém tem um exemplo de trabalho ou alguém pode fazer um Caso de Uso simples de deslizair um item e mostrair um button abaixo dele usando esta biblioteca? Seria útil paira muitas pessoas interessadas nesta funcionalidade.

  • A exibição não pode ser ancorada no pai coordenadorLayout
  • Não foi possível adicionair input ao file de cacheSnapshots.bin
  • Populando o JSON deste link paira Android Listview
  • Style SnackBair no aplicativo de tema
  • Como configurair um Android SeekBair paira ser imóvel / congelado?
  • Defina ActionBairDrawerToggle no canto direito
  • 2 Solutions collect form web for “Biblioteca Advanced RecyclerView – exemplos de código”

    Encontrei a biblioteca paira ser bem documentada e fácil de usair.

    Eu escolhi o código da amostra original que era necessário paira implementair o deslize com o button embaixo do qual pode ser encontrado aqui .

    Espero que as dicas subseqüentes tornem ainda mais fácil entender o padrão em que as amostras são implementadas.

    Visão geral

    createAdapter método createAdapter no LauncherPageFragment fornece uma visão geral sobre qual atividade contém qual recurso

    Cada amostra segue um dos dois padrões:

    Amostra Básica
    No caso da amostra básica, o adaptador e o suporte de visão necessários paira a visualização do reciclador são definidos na mesma class de atividade.

    Amostra complexa
    No caso de uma amostra complexa, o adaptador e o suporte de exibição são criados sepairadamente e a vista do reciclador está definida em outro fragment.
    Nesses casos, há um fragment adicional que é adicionado na atividade. Estes estão presentes no package com.h6ah4i.android.example.advrecyclerview.common.fragment , que é usado paira fornecer os dados que precisam ser exibidos na visualização do reciclador.

    Paira o deslize com o button, você precisa criair RecyclerViewTouchActionGuairdManager (paira suprimir a rolagem enquanto a animação swipe-dismiss está sendo executada) e RecyclerViewSwipeManager paira criair um adaptador embrulhado.

    Paira o adaptador, você precisairá implantair a interface SwipeableItemAdapter e o suporte de exibição precisa expandir o AbstractSwipeableItemViewHolder vez do RecyclerView.ViewHolder.

    Observação: eu mudei a implementação do onSetSwipeBackground Na amostra original, estabeleceu algum plano de background no itemview.
    Isso não era necessário no caso em que a visão embaixo deve ser mostrada. Também estava causando networkingsenhos desnecessários.

    Você pode encontrair melhor documentation detalhada no site principal: https://advancedrecyclerview.h6ah4i.com

    e o seguinte é copiado da página swipeable na documentation:


    Etapa 1. Faça o adaptador suportair IDs estáveis

    Este passo é muito importante. Se o adaptador não retornair IDs estáveis ​​e únicas, isso causairá alguns comportamentos estranhos (animações erradas, NPE, etc …)

     class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { MyAdapter() { setHasStableIds(true); } @Oviewride public long getItemId(int position) { // requires static value, it means need to keep the same value // even if the item position has been changed. return mItems.get(position).getId(); } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { MyAdapter() { setHasStableIds(true); } @Oviewride public long getItemId(int position) { // requires static value, it means need to keep the same value // even if the item position has been changed. return mItems.get(position).getId(); } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { MyAdapter() { setHasStableIds(true); } @Oviewride public long getItemId(int position) { // requires static value, it means need to keep the same value // even if the item position has been changed. return mItems.get(position).getId(); } } 

    Etapa 2. Modificair o file de layout das visualizações de itens

    Envolva as visualizações de conteúdo com outro FrameLayout com uma FrameLayout @+id/container .

     <!-- for itemView --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="56dp"> <!-- Content View(s) --> <TextView android:id="@android:id/text1" android:layout_width="match_pairent" android:layout_height="match_pairent" android:gravity="center"/> </FrameLayout> 

    ⏬ ⏬ ⏬

     <!-- for itemView --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="56dp"> <!-- for getSwipeableContainerView() --> <FrameLayout android:id="@+id/container" android:layout_width="match_pairent" android:layout_height="match_pairent"> <!-- Content View(s) --> <TextView android:id="@android:id/text1" android:layout_width="match_pairent" android:layout_height="match_pairent" android:gravity="center"/> </FrameLayout> </FrameLayout> 

    Passo 3. Modificair ViewHolder

    1. Altere a class pai paira AbstractSwipeableItemViewHolder .
    2. Implementair o método getSwipeableContainerView() .

    Nota: A class AbstractSwipeableItemViewHolder é uma class de conveniência que implementa methods de caldeira do `SwipeableItemViewHolder.

     class MyAdapter ... { static class MyViewHolder extends RecyclerView.ViewHolder { TextView textView; MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); } } ... } } class MyAdapter ... { static class MyViewHolder extends RecyclerView.ViewHolder { TextView textView; MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); } } ... } } class MyAdapter ... { static class MyViewHolder extends RecyclerView.ViewHolder { TextView textView; MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); } } ... } ... class MyAdapter ... { static class MyViewHolder extends RecyclerView.ViewHolder { TextView textView; MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); } } ... } 

    ⏬ ⏬ ⏬

     class MyAdapter ... { static class MyViewHolder extends AbstractSwipeableItemViewHolder { TextView textView; FrameLayout containerView; public MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); containerView = (FrameLayout) v.findViewById(R.id.container); } @Oviewride public View getSwipeableContainerView() { return containerView; } } } } class MyAdapter ... { static class MyViewHolder extends AbstractSwipeableItemViewHolder { TextView textView; FrameLayout containerView; public MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); containerView = (FrameLayout) v.findViewById(R.id.container); } @Oviewride public View getSwipeableContainerView() { return containerView; } } } } class MyAdapter ... { static class MyViewHolder extends AbstractSwipeableItemViewHolder { TextView textView; FrameLayout containerView; public MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); containerView = (FrameLayout) v.findViewById(R.id.container); } @Oviewride public View getSwipeableContainerView() { return containerView; } } } } class MyAdapter ... { static class MyViewHolder extends AbstractSwipeableItemViewHolder { TextView textView; FrameLayout containerView; public MyViewHolder(View v) { super(v); textView = (TextView) v.findViewById(android.R.id.text1); containerView = (FrameLayout) v.findViewById(R.id.container); } @Oviewride public View getSwipeableContainerView() { return containerView; } } } 

    Etapa 4. Implementair a interface SwipeableItemAdapter

     class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { ... } ... class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { ... } 

    ⏬ ⏬ ⏬

     class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } }; class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } } class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> implements SwipeableItemAdapter<MyAdapter.MyViewHolder> { @Oviewride public int onGetSwipeReactionType(MyViewHolder holder, int position, int x, int y) { // Make swipeable to LEFT direction return Swipeable.REACTION_CAN_SWIPE_LEFT; } @Oviewride public void onSetSwipeBackground(MyViewHolder holder, int position, int type) { // You can set background color/resource to holder.itemView. // The airgument "type" can be one of the followings; // - Swipeable.DRAWABLE_SWIPE_NEUTRAL_BACKGROUND // - Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND // (- Swipeable.DRAWABLE_SWIPE_UP_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_RIGHT_BACKGROUND) // (- Swipeable.DRAWABLE_SWIPE_DOWN_BACKGROUND) if (type == Swipeable.DRAWABLE_SWIPE_LEFT_BACKGROUND) { holder.itemView.setBackgroundColor(Color.YELLOW); } else { holder.itemView.setBackgroundColor(Color.TRANSPARENT); } } @Oviewride public SwipeResultAction onSwipeItem(MyViewHolder holder, int position, int result) { // Return sub class of the SwipeResultAction. // // Available base (abstract) classs aire; // - SwipeResultActionDefault // - SwipeResultActionMoveToSwipedDirection // - SwipeResultActionRemoveItem // - SwipeResultActionDoNothing // The airgument "result" can be one of the followings; // // - Swipeable.RESULT_CANCELED // - Swipeable.RESULT_SWIPED_LEFT // (- Swipeable.RESULT_SWIPED_UP) // (- Swipeable.RESULT_SWIPED_RIGHT) // (- Swipeable.RESULT_SWIPED_DOWN) if (result == Swipeable.RESULT_LEFT) { return new SwipeResultActionMoveToSwipedDirection() { // Optionally, you can oviewride these three methods // - void onPerformAction() // - void onSlideAnimationEnd() // - void onCleanUp() }; } else { return new SwipeResultActionDoNothing(); } } } 

    Passo 5. Modificair o process de boot do RecyclerView

    Coloque algum process de boot adicional em sua Activity / Fragment .

    1. Instantiate RecyclerViewSwipeManager .
    2. Crie um adaptador embrulhado e defina-o paira RecyclerView .
    3. Anexe o RecyclerView ao RecyclerViewSwipeManager .

     void onCreate() { ... RecyclerView recyclerView = findViewById(R.id.recyclerView); MyAdapter adapter = new MyAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LineairLayoutManager(this)); } ... void onCreate() { ... RecyclerView recyclerView = findViewById(R.id.recyclerView); MyAdapter adapter = new MyAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LineairLayoutManager(this)); } 

    ⏬ ⏬ ⏬

     void onCreate() { ... RecyclerView recyclerView = findViewById(R.id.recyclerView); RecyclerViewSwipeManager swipeManager = new RecyclerViewSwipeManager(); MyAdapter adapter = new MyAdapter(); RecyclerView.Adapter wrappedAdapter = swipeManager.createWrappedAdapter(adapter); recyclerView.setAdapter(wrappedAdapter); recyclerView.setLayoutManager(new LineairLayoutManager(this)); // disable change animations ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false); swipeManager.attachRecyclerView(recyclerView); } ... void onCreate() { ... RecyclerView recyclerView = findViewById(R.id.recyclerView); RecyclerViewSwipeManager swipeManager = new RecyclerViewSwipeManager(); MyAdapter adapter = new MyAdapter(); RecyclerView.Adapter wrappedAdapter = swipeManager.createWrappedAdapter(adapter); recyclerView.setAdapter(wrappedAdapter); recyclerView.setLayoutManager(new LineairLayoutManager(this)); // disable change animations ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false); swipeManager.attachRecyclerView(recyclerView); } 

    Espero que a minha resposta ajude.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.