2

I want to perform some action when a scroll event has happened in android webview. Is there any way to do that

I tried this

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;
    }
};

but it is not working... Is there anything like a scroll listener in android for a webview

CRUSADER
  • 5,486
  • 3
  • 28
  • 64
jubin
  • 153
  • 5
  • 15

1 Answers1

0

Please try this you may get answer

<!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>
Amit Prajapati
  • 13,525
  • 8
  • 62
  • 84