2

当android webview中发生滚动事件时,我想执行一些操作。有没有办法做到这一点

我试过这个

OnTouchListener onTouchListener = new View.OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {

        int action = event.getAction();
        if (action == MotionEvent.ACTION_UP) {
            //do something
        }

        return false;
    }
};

但它不工作......在android中有没有类似滚动监听器的webview

4

1 回答 1

0

请试试这个你可能会得到答案

<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
* { margin:0; padding:0; }
body { background:#ccc; }
#page { margin:0 auto; width:600px; background:#fff; height:3000px; 
        text-align:center; line-height:100px; font-size:30px; }
#flyout { width:300px; height:100px; position:fixed; right:-300px;
          bottom:10px; background:#333; color:#fff; display:none; }
#bottom { margin:0 auto; width:600px; background:#eee; line-height:40px; }  
</style>

<style id="jsbin-css">

</style>
</head>
<body>
  <div id="page">Scroll to the very bottom of this page!
  </div>
<script>
$(document).ready(function () {
  var last = +new Date;
  $(window).scroll(function () {

   console.log("Your Scroll");

  });
});
</script>

</body>
</html>
于 2013-08-21T09:29:36.303 回答