本文介绍了的WebView detuct html标记机器人如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

articleText.setOnTouchListener(new OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    WebView.HitTestResult hr = ((WebView)v).getHitTestResult();

                   Logger.logInfo(tag, "getExtra = "+ hr.getExtra() + "\t\t Type=" + hr.getType());

//我建立与视频网址的HTML文件,我怎么能得到的WebView视频类型和网址?

// i build html file with video url, how can i get the video type and url in webview?

//还是我奋力我怎样才能获得视频类型和URL ........请帮助

//still i am struggling how can i get video type and url........pls help

推荐答案

您可以dectect的WebView onTouch内HTML标记为:

you can dectect HTML TAG inside WebView onTouch as:

articleText.setOnTouchListener(new OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {
WebView.HitTestResult hr = ((WebView)v).getHitTestResult();


Logger.logInfo(tag, "getExtra = "+ hr.getExtra() +
          "\t\t Type=" + hr.getType());

int resultType = result.getType();

switch (resultType){
  case HitTestResult.ANCHOR_TYPE:
    Log.v("HitTestResult.ANCHOR_TYPE");
  break;
  case HitTestResult.IMAGE_ANCHOR_TYPE:
    Log.v("HitTestResult.IMAGE_ANCHOR_TYPE");
  break;
  case HitTestResult.SRC_ANCHOR_TYPE:
    Log.v("HitTestResult.SRC_ANCHOR_TYPE");
  break;
  case HitTestResult.SRC_IMAGE_ANCHOR_TYPE:
    Log.v("HitTestResult.SRC_IMAGE_ANCHOR_TYPE");
  break;
  default:
    Log.v("Invalid");

  }
}

这篇关于的WebView detuct html标记机器人如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:40