title: Fix an element on ScrollView
body: <p>I wanna do something like a <a href="http://codepen.io/Guilh/pen/JLKbn" rel="nofollow">sticky menu</a>, but I do not have any clue about this. My XML is something like this:</p>
  
  <pre><code>&lt;com.example.customscrollview.scrollview
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"&gt;
      &lt;FrameLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
          &lt;!-- I need sticky this element bellow! --&gt;
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="210.0dip"
              android:orientation="vertical"&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:layout_marginTop="210.0dip"&gt;
              &lt;!-- A lot of TextViews --&gt;
              &lt;TextView...&gt;
              &lt;TextView...&gt;
              &lt;TextView...&gt;
          &lt;/LinearLayout&gt;
      &lt;/FrameLayout&gt;
  &lt;/com.example.customscrollview.scrollview&gt;
  </code></pre>
  
  <p>I tried do it programmatically:</p>
  
  <pre><code>private void setTouchListeners() {
      setOnTouchListener(new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              boolean rt = false;
              if (event.getAction() == MotionEvent.ACTION_MOVE) {
                  final View element = (View) findViewById(R.id.element);
                  LayoutParams params = new LayoutParams(
                          LayoutParams.MATCH_PARENT,
                          element.getHeight()
                  );
                  params.setMargins(0, (int) getScrollY(), 0, 0);
                  params.gravity = Gravity.TOP;
                  element.setLayoutParams(params);
                  Handler handler = new Handler();
                  handler.post(new Runnable() {
                      @Override
                      public void run() {
                          childElement.requestLayout();
                      }
                  });
              }
              return rt;
          }
      });
  }
  </code></pre>
  
  <p>It works but isn't perfect. When the ScrollView begin fling, the movement isn't completed, because the <code>MotionEvent</code> only hook the touch events. So I overwrite the <code>onScrollChanged</code> to do the same function (with some changes). Good, now the element stays in the top, but it do not follow the scroll movement, it becomes "unstable" until the scroll stops (result of the fling and fast scroll velocity).</p>
  
  <p>What is the better way to do it?</p>