我在一个城镇应用程序中工作,我已经构建了一个 tab5.html,它有 4 个电话号码
<a href="tel://0259944">0259 944</a>
我也尝试过不使用 // 但它现在可以工作了,单击 webview tel 链接时我该怎么做才能打电话?
这是我尝试使用和不使用 Intent 的代码,但它是同样的问题 :( 任何人都可以帮助我吗?
@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");
Intent intent = new Intent(Intent.ACTION_DIAL);
startActivity(intent);
}
return rootView;
}
}