1

嗨,Android 和 Java 还是新手。

请看一下这段代码,我收到多个标记错误,无法弄清楚我在哪里缺少字符或括号。它表示最后两个括号的错误。

public class watsnuut extends Activity{      

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.watsnuut);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    WebView webView = (WebView) findViewById(R.id.webView2);
    final ProgressBar progess = (ProgressBar) findViewById(R.id.ProgressBar);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("http://kyknet.dstv.com/nuus/");
    webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }



    }
  }

提前致谢

4

2 回答 2

1

你没有关闭setWebViewClient方法调用

webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }

});

于 2012-08-29T13:44:26.527 回答
0

您忘记添加});

 webView.setWebViewClient(new WebViewClient() {
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                progess.setVisibility(View.VISIBLE);
            }
            public void onPageFinished(WebView view, String url) {
            progess.setVisibility(View.GONE);
            }
    });

代替

webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }
于 2012-08-29T13:44:49.477 回答