title: Make NEXT button in HorizontalView to scroll through different ImageView
body: <p>I have an HorizontalView. Inside, there is a LinearLayout where I add multiple ImageView through code. I want to implement the NEXT and PREVIOUS button so it scrolls automatically. I also want to hide the buttons when I reach the end of my HorizontalView.</p>
  
  <p><a href="https://imgur.com/a/313af" rel="nofollow noreferrer">http://imgur.com/a/313af</a></p>
  
  <p>I don't know how to do it.</p>
  
  <p>Edit: This CardView is inside of a recyclerView. </p>
  
  <p>Here is the XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/card_view"
      android:layout_width="match_parent"
      android:layout_height="350dp"
      android:layout_gravity="center"
      android:layout_margin="8dp"
      card_view:cardCornerRadius="4dp"
      &gt;
  
      &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:columnCount="1"
          android:paddingTop="5dp"&gt;
  
          &lt;TextView
              android:id="@+id/nombrecito"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="center"
  
              android:maxLines="1"
              android:textAppearance="@style/TextAppearance.AppCompat"
              android:textSize="20sp"
              android:fontFamily="fonts/rugs_font.otf"/&gt;
  
          &lt;RelativeLayout&gt;
  
              &lt;HorizontalScrollView
                  android:id="@+id/horizontal_scroll"
                  android:layout_width="wrap_content"
                  android:layout_height="254dp"                &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/linear"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:orientation="horizontal"
  
                      android:fitsSystemWindows="false"&gt;
  
                      &lt;ImageView
  
                          android:id="@+id/foto"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_marginLeft="-10dp"
                          android:contentDescription="fotografía"
                          android:scaleType="fitEnd"
                          android:src="@android:drawable/ic_menu_camera" /&gt;
                  &lt;/LinearLayout&gt;
  
              &lt;/HorizontalScrollView&gt;
              &lt;ImageButton
                  android:shape="ring"
                  android:layout_width="40dp"
                  android:layout_height="40dp"
                  android:background="#ceb06a"
                  android:layout_alignParentLeft="true"
                  android:layout_centerVertical="true"
                  android:src="@drawable/ic_keyboard_arrow_left_black_48dp"/&gt;
              &lt;ImageButton
                  android:shape="ring"
                  android:layout_width="40dp"
                  android:layout_height="40dp"
                  android:background="#ceb06a"
                  android:layout_alignParentRight="true"
                  android:layout_centerVertical="true"
                  android:src="@drawable/ic_keyboard_arrow_right_black_48dp"/&gt;
          &lt;/RelativeLayout&gt;
  
  
          &lt;GridLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:rowCount="1"&gt;
  
              &lt;ImageButton
                  android:id="@+id/btnLike"
                  android:layout_width="48dp"
                  android:layout_height="48dp"
                  android:background="@android:color/transparent"
                  android:inAnimation="@anim/slide_in_likes_counter"
                  android:outAnimation="@anim/slide_out_likes_counter"
                  android:src="@drawable/ic_heart_outline_grey" /&gt;
  
              &lt;ImageButton
                  android:id="@+id/btnShare"
                  android:layout_width="48dp"
                  android:layout_height="48dp"
                  android:background="@android:color/transparent"
                  android:onClick="share"
                  android:src="@android:drawable/ic_menu_share" /&gt;
  
          &lt;/GridLayout&gt;
      &lt;/GridLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>