Facebook在Android中的盒子不显示帖子

时间:2013-06-20 17:16:40

标签: android android-webview facebook-likebox

我需要帮助。 Android中的我的应用程序不会在webview中显示facebook帖子。 我喜欢盒子网址。

代码:

@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");
    }
请帮助我。 THX

1 个答案:

答案 0 :(得分: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);

        }