title: Android : Locating the item at center position of the screen after selecting it ,In the horizontalscrollview
body: <p>I am trying to scroll item to the middle position of the screen after selecting it.I have used Horizontalscrollview  and LinearLayout inside it to add item. I show in the XML</p>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".MainActivity" &gt;
  
    &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_above="@+id/bottom"
          android:orientation="vertical" &gt;
  
         &lt;HorizontalScrollView
                  android:id="@+id/scrollView"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/updown"
                  android:layout_weight="0.8"
                  android:fadingEdgeLength="0dp" &gt;
  
                  &lt;LinearLayout
                      android:id="@+id/horizontalbar"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:background="@color/tlbackground"
                      android:baselineAligned="true"
                      android:orientation="horizontal" &gt;
                  &lt;/LinearLayout&gt;
         &lt;/HorizontalScrollView&gt;
    &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Class</strong></p>
  
  <pre><code>public class MainActivity extends FragmentActivity implements ActionBar.TabListener
  {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) 
      {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        hsl = (HorizontalScrollView) findViewById(R.id.scrollView);
        LinearLayout l1 = (LinearLayout)findViewById(R.id.horizontalbar);
  
          for(int i = 0; i &lt; 20; i++)
          {
              Button b = new Button(this);
              b.setText("t"+i);
              ll.addView(b);
          }
       }
  }
  </code></pre>
  
  <p>I want something like in figure</p>
  
  <p><strong>before click</strong></p>
  
  <p><img src="https://i.stack.imgur.com/Vu0ma.png" alt="enter image description here"></p>
  
  <p><strong>after click</strong></p>
  
  <p><img src="https://i.stack.imgur.com/UbGxQ.png" alt="enter image description here"></p>
  
  <p><strong>How can I Scroll that selected item to the middle in HorizontalScrollview?</strong></p>