2017-07-31 50 views
0

我在Android应用程序的工作,我加载自定义HTML数据的提交按钮,表单提交..自定义HTML中成功加载web视图后,当我从它要求的HTML里面的内容重定向用于外部浏览器。我如何修复在同一个webview中工作?的Android载入网址

这里是我的代码:下面的代码

wb = (WebView)findViewById(R.id.webv); 

     wb.getSettings().setLoadsImagesAutomatically(true); 
     wb.getSettings().setJavaScriptEnabled(true); 
     wb.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); 
String customHtml= "<html>...</html>" 

wb.loadData(customHtml, "text/html", "UTF-8"); 

回答

0

添加此行 wb.setWebViewClient(新WebViewClient());

+0

你可以为这种情况提供任何工作示例的形式。 – user6768912

+0

@ user6768912有没有帮助? – t6chgeek

+0

是..非常感谢 – user6768912

0

使用;

WebView view = new WebView(MainActivity.this); 
view.setVerticalScrollBarEnabled(false); 

((LinearLayout)rootView.findViewById(R.id.text_about)).addView(view); 

view.loadData(getString(R.string.about), "text/html; charset=utf-8", "utf-8"); 

在string.xml

<string name="about"><![CDATA[ <html> <head></head> <body style="text-align:justify;color:#059bba;background-color:#FF‌​F;"> here enter your text </body> </html> ]]> </string> 
+0

没有再次读取我的问题..我的自定义HTML加载成功,之后当我按下提交按钮,提交网址,它要求外部浏览器 – user6768912