title: Start and end the horizontal scrollview from center of the screen
body: <p>I need to start and end the content inside the Horizontal scrollview, like we had in Gallery (deprecated) widget. Contents inside the Horizontal scrollview should start from the center of the screen, and while scrolling, it should move to left from the center, the same as Gallery. </p>
  
  <p>I have few hundred images, populated dynamically in the linearlayout inside the Horizontal scrollview. I acheived to auto scroll the horizontal scrollview with the time delay of one second. But I need to start the content from center and end in center.</p>
  
  <pre><code>public class ImageGalleryScrollActivity
          extends AppCompatActivity {
      HorizontalScrollView horizontalScrollView;
      int maxCount=59;
      Handler mHandler = new Handler(new Handler.Callback() {
  
          @Override
          public boolean handleMessage(Message msg) {
              horizontalScrollView.smoothScrollBy(maxCount, 0);     
  
              mHandler.sendMessageDelayed(new Message(), 1000);
              return false;
          }
      });
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.horizontal_scroll_activity);
          horizontalScrollView=(HorizontalScrollView)findViewById(R.id.horizontalView);
          mHandler.sendMessageDelayed(new Message(), 1000);     
      }   
  }
  </code></pre>
  
  <p>layout file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"&gt;
  
      &lt;HorizontalScrollView
          android:id="@+id/horizontalView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_gravity="center_horizontal"
          android:fillViewport="true"&gt;
  
          &lt;LinearLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/HorizontalScrollView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>