mtuygun
mtuygun

Reputation: 113

Android webview doesn't open twitter page properly

I have an Android app which opens some pages in webview. You can see the

screenshot of the page. I can't see the tweets on can see the header.

I have tried all webview settings but it is not working properly.

webview.getSettings().setJavaScriptEnabled(true);
webview.setWebViewClient(new MyWebViewClient());
webview.setWebChromeClient(new MyWebChromeClient);
webview.getSettings().setDefaultTextEncodingName("utf-8");
webview.getSettings().setPluginState(PluginState.ON);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setDisplayZoomControls(false);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setDomStorageEnabled(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

[edit] I am getting error on console below :

I/chromium: [INFO:CONSOLE(0)] "Refused to load the image 'https://www.google.com.tr/ads/ga-audiences?v=1&aip=1&t=sr&_r=4&tid=UA-30775-67&cid=1855674525.1467776671&jid=2048800659&_v=j44&z=267031279&ipr=y' because it violates the following Content Security Policy directive: "img-src 'self' 'unsafe-inline' blob: data: https://*.cdn.twitter.com https://ton.twitter.com https://*.twimg.com https://stats.g.doubleclick.net https://www.google.com https://www.google-analytics.com https://www.periscope.tv".
            ", source: https://mobile.twitter.com/home (0)

Upvotes: 1

Views: 798

Answers (1)

mtuygun
mtuygun

Reputation: 113

You must set layout_width and layout_height attributes like below.

android:layout_width="match_parent"
android:layout_height="match_parent" 

Upvotes: 2

Related Questions