我在google上搜索但是我尝试过的都没有用,这是我的代码你可以帮我把这个只放在tab6上吗?所以我有4个链接电话:tab5.html上的号码,我想点击它们时不打电话给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;
}
}
答案 0 :(得分:0)
无论您在tab5.html
中放置了哪些内容,请确保tel
协议与此匹配:<a href="tel://123456789">Click to Call Me</a>