title: How to get the scroll position of webView
body: <p>What I'm trying to do is to get my webView scroll position to when it's not on top, makes my header opaque. I've tried many things to get my scroll postion, like implents OnScrollListener and OnScrollChangedListener to my activity, but anyone works and I have no idea what to do. I have the following xml Layout in my activity</p>
  
  <pre><code>   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          tools:context=".BrowserActivity"
           &gt;
  
      &lt;LinearLayout
          android:id="@+id/header"
          android:layout_width="fill_parent"
          android:layout_height="44dp"
          android:background="@drawable/header" &gt;
  
          &lt;TextView
                  android:id="@+id/browser_title"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:maxLines="1"
                  android:layout_gravity="center"
                  android:gravity="center"
                  android:layout_marginLeft="@dimen/margin_left_browser_title"
                  android:layout_marginRight="@dimen/margin_right_browser_title"
                  android:text="@string/empty"
                  android:textStyle="bold"
                  android:textSize="@dimen/txt_size_browser_title"
                  android:textColor="@color/white"
                  /&gt;
  
          &lt;ProgressBar
              android:id="@+id/progressUrl"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="@dimen/margin_left_browser_progress"
              android:layout_marginTop="5dp"
              android:layout_marginBottom="5dp"  /&gt;
  
          &lt;Button
              android:id="@+id/back"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="@dimen/margin_left_browser_progress" 
              android:layout_marginTop="3dp"
              android:layout_marginBottom="3dp"
              android:background="@drawable/btn_navigation_left"
              /&gt;
  
          &lt;Button
              android:id="@+id/forward"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginTop="3dp"
              android:layout_marginBottom="3dp"
              android:layout_marginRight="@dimen/margin_right_btn_download"
              android:background="@drawable/btn_navigation_right"
              /&gt;
      &lt;/LinearLayout&gt;
  
           &lt;WebView
               android:id="@+id/webView1"
               android:layout_below="@id/header"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               /&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And the following Activity:</p>
  
  <pre><code>public class BrowserActivity extends Activity {
  
      String url;
      WebView webView;
      ProgressBar progressUrl;
  
  @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.activity_browser);
  
          progressUrl = (ProgressBar) findViewById(R.id.progressUrl);
          Bundle extras = getIntent().getExtras();
  
          if (extras != null) {
  
              metaDado = extras.getParcelable("metaDado");
          }
  
          TextView browserTitle = (TextView) findViewById(R.id.browser_title);
  
          browserTitle.setText(metaDado.getName());
  
          webView = (WebView) findViewById(R.id.webView1);
  
          webView.getSettings().setJavaScriptEnabled(true);
          webView.getSettings().setBuiltInZoomControls(true);
          webView.getSettings().setSupportZoom(true);
          webView.getSettings().setUseWideViewPort(true);
          webView.getSettings().setLoadWithOverviewMode(true);
  
          if (metaDado.getType().equals(Constants.FULL)) {
  
              url = "file://" + Constants.DEST_PATH_PARENT + "/" + metaDado.getUuidInstituicao() + "/full/"
                      + metaDado.getOfflineUuid() + "/index.html";
  
          } else if (metaDado.getType().equals(Constants.PRES)) {
  
              url = "file://" + Constants.DEST_PATH_PARENT + "/" + metaDado.getUuidInstituicao() + "/pres/"
                      + metaDado.getOfflineUuid() + "/" + metaDado.getOfflineUuid() + "/index.html";
          }
  
          webView.setWebViewClient(new WebViewClient() {
  
              @Override
              public void onPageStarted(WebView view, String url, Bitmap favicon) {
  
                  progressUrl.setVisibility(View.VISIBLE);
  
                  super.onPageStarted(view, url, favicon);
              }
  
              @Override
              public boolean shouldOverrideUrlLoading(WebView view, String url) {
  
                  view.loadUrl(url);
                  return true;
              }
  
              @Override
              public void onPageFinished(WebView view, String url) {
                  super.onPageFinished(view, url);
  
                  progressUrl.setVisibility(View.GONE);
              }
  
          });
  
          webView.loadUrl(url);
  
      }
  }
  </code></pre>