【问题标题】:WebView tel: link not workingWebView 电话:链接不起作用
【发布时间】:2013-12-13 16:58:12
【问题描述】:

我在谷歌上搜索过,但我尝试过的所有方法都不起作用,这是我的代码,你能帮我把它只放在 tab6 上吗?所以我在 tab5.html 上有 4 个链接 tel:number 并且我想在单击它们时调用它们以不显示 404 。

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

        Bundle args = getArguments();
        int position = args.getInt(ARG_OBJECT);

        int tabLayout = 0;
        switch (position) {
        case 0:
        tabLayout = R.layout.tab1;
        break;
        case 1:
        tabLayout = R.layout.tab2;
        break;
        case 2:
        tabLayout = R.layout.tab3;
        break;
        case 3:
        tabLayout = R.layout.tab4;
        break;
        case 5:
        tabLayout = R.layout.tab6;
        break; 
        case 4:
        tabLayout = R.layout.tab5;
        break; 

        }

        View rootView = inflater.inflate(tabLayout, container, false);

        webView = (WebView) rootView.findViewById(R.id.webView1);
        WebView tab2 = (WebView) rootView.findViewById(R.id.webView2);
        WebView tab3 = (WebView) rootView.findViewById(R.id.webView3);
        WebView tab4 = (WebView) rootView.findViewById(R.id.webView4);
        WebView tab5 = (WebView) rootView.findViewById(R.id.webView5);
        WebView tab6 = (WebView) rootView.findViewById(R.id.webView6);




        if (webView != null) {
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("file:///android_asset/tab1.html");
        }

        if (tab2 != null) {
            tab2.setWebViewClient(new WebViewClient());
            tab2.loadUrl("file:///android_asset/tab2.html");
            }

        if (tab3 != null) {
            tab3.setWebViewClient(new WebViewClient());
            tab3.loadUrl("file:///android_asset/tab3.html");
            }

        if (tab4 != null) {
            tab4.setWebViewClient(new WebViewClient());
            tab4.loadUrl("file:///android_asset/tab4.html");
            }
        if (tab5 != null) {
            tab5.setWebViewClient(new WebViewClient());
            WebSettings tb5 = tab5.getSettings();
            tb5.setJavaScriptEnabled(true);
            tab5.loadUrl("http://fbhostinger.com/po/map.html");
            }
        if (tab6 != null) {
            tab6.setWebViewClient(new WebViewClient());
            tab6.loadUrl("file:///android_asset/tab5.html");
            }




        return rootView;
    }
    }

【问题讨论】:

  • 您在tab5.html 中提供的超链接是什么?

标签: android webview tel


【解决方案1】:

无论您在 tab5.html 中放置了什么,请确保 tel 协议与此匹配:<a href="tel://123456789">Click to Call Me</a>

【讨论】:

    猜你喜欢
    • 2012-01-04
    • 2012-08-05
    • 2016-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-14
    相关资源
    最近更新 更多