监听WebView滑动到底端
来源:互联网 发布:天罡掌诀推算法 编辑:程序博客网 时间:2024/05/01 16:00
public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Wv wv = (Wv)this.findViewById(R.id.test); wv.loadUrl("http://m.aoyou.com/about.aspx"); wv.setOnCustomScroolChangeListener(new ScrollInterface(){ @Override public void onSChanged(int l, int t, int oldl, int oldt) { Log.e("Value",(wv.getContentHeight()*wv.getScale() -(wv.getHeight()+wv.getScrollY()))+""); if(wv.getContentHeight()*wv.getScale() -(wv.getHeight()+wv.getScrollY())==0){ //已经处于底端 } } }); } }
public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Wv wv = (Wv)this.findViewById(R.id.test); wv.loadUrl("http://m.aoyou.com/about.aspx"); wv.setOnCustomScroolChangeListener(new ScrollInterface(){ @Override public void onSChanged(int l, int t, int oldl, int oldt) { Log.e("Value",(wv.getContentHeight()*wv.getScale() -(wv.getHeight()+wv.getScrollY()))+""); if(wv.getContentHeight()*wv.getScale() -(wv.getHeight()+wv.getScrollY())==0){ //已经处于底端 } } }); } }
public interface ScrollInterface { public void onSChanged(int l, int t, int oldl, int oldt) ;}