0

我需要帮助。我在 Android 中的应用程序不会在 webview 中显示 facebook 帖子。我使用like box url。

代码:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView wv = (WebView)findViewById(R.id.content);
        wv.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                //view.loadUrl(url);
                return super.shouldOverrideUrlLoading(view, url);
            }
        });
        wv.loadUrl("http://www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fpages%2FFacebookDevelopers%2F137639306301187&show_faces=true&colorscheme=light&stream=true&show_border=false&header=false&width=480&height=800");
    }

请帮助我。谢谢

4

1 回答 1

0
//Facebook use javascript to show feeds you have to enable javascript in your code. Try this.   
 @Override 
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            WebView wv = (WebView)findViewById(R.id.webView1);
            WebSettings webSettings = wv.getSettings();
            webSettings.setJavaScriptEnabled(true);
            webSettings.setUseWideViewPort(true);
            webSettings.setLoadWithOverviewMode(true);
            wv.setWebViewClient(new WebViewClient(){
               @Override
               public boolean shouldOverrideUrlLoading(WebView view, String url) {
                   //view.loadUrl(url);
                   return super.shouldOverrideUrlLoading(view, url);
               }
           });
           wv.loadUrl("your URL");

           wv.getSettings().setUseWideViewPort(true);

        }
于 2013-09-26T14:11:28.083 回答