另一个类的WebViewFragment中的LoadURL?

时间:2016-06-27 03:43:36

标签: android webview fragment

我有一个扩展Private Sub ComboBox1_Change() Dim strMonth(0 To 11) As String strMonth(0) = "Print April Table" strMonth(1) = "Print May Table" strMonth(2) = "Print June Table" strMonth(3) = "Print July Table" strMonth(4) = "Print August Table" strMonth(5) = "Print September Table" strMonth(6) = "Print October Table" strMonth(7) = "Print November Table" strMonth(8) = "Print December Table" strMonth(9) = "Print January Table" strMonth(10) = "Print February Table" strMonth(11) = "Print March Table" Dim mthPosition As Long For mthPosition = LBound(strMonth) To UBound(strMonth) UserForm13.ComboBox1.AddItem strMonth(mthPosition) Next mthPosition With UserForm13.ComboBox1 .Style = fmStyleDropDownList End With UserForm13.Show End Sub 的类,我想要实现的是能够将其他类的其他URL加载到此WebViewFragment类中。以下是我的代码的样子:

WebViewFragment

知道如何访问public class FragWeber extends WebViewFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); WebView webView = getWebView(); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDisplayZoomControls(false); webView.setWebViewClient(new WebViewClient()); webView.loadUrl("https://www.google.com"); } } 以加载其他网址吗?

1 个答案:

答案 0 :(得分:0)

   webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            String url1 = url;  // can add your URL address
            view.loadUrl(url);
            return false;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
        }
    });