title: Android Translate ScrollView and Views in sync (Programmatically)
body: <p>I have a <code>FrameLayout</code> at top
  and <code>ViewPager</code> at bottom <br>
  <code>FrameLayout</code> has <code>PagerTabStrips</code> <br>
  <code>ViewPager</code> has <code>ScrollView</code> in it.</p>
  
  <p>What I am trying to achieve is that on the scroll of ViewPager's ScrollView, I want to translate Y position of <code>ViewPager</code> and <code>FrameLayout</code> together in sync smoothly.
  And at some point I have to fix the position of <code>FrameLayout</code> and stop its further scrolling to top.</p>
  
  <p><strong>Below is my xml code:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res/com.example"
      xmlns:fab="http://schemas.android.com/apk/res-auto"
      android:id="@+id/parentRelativeLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/black"
      android:clickable="true"
      android:clipToPadding="false"
      android:fitsSystemWindows="true" &gt;
  
        &lt;FrameLayout
          android:id="@+id/header"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
  
              &lt;com.sticky.pager.PagerSlidingTabStrip
                  android:id="@+id/tabs"
                  android:layout_width="match_parent"
                  android:layout_height="48dip"
                  android:layout_gravity="bottom"
                  android:layout_marginTop="2dp" /&gt;
  
      &lt;/FrameLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/pager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@+id/header"
          android:background="@color/blue" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>How can I achieve this programmatically:</p>
  
  <pre><code>@Override
      public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount, int pagePosition) {
  
  
          float scrollY=getScrollY(view);
          mViewPager.setTranslationY(-scrollY);
          mHeader.setTranslationY(-scrollY);
         //What to write here??? This does not work
  </code></pre>