1

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)
mtuygun
  • 113
  • 1
  • 8
  • Post the complete logs. –  Jul 04 '16 at 10:43
  • 1
    check this link:http://stackoverflow.com/questions/6856814/problems-loading-mobile-twitter-in-webview – prakash Jul 04 '16 at 10:43
  • Yes. I have already checked prakask. But i have checked the log. There is no clear problem. You can check the problem in my app from https://play.google.com/store/apps/details?id=tr.com.socialmedia address. This is new it working just twp weeks ago. But i dont what has changed it is not working for after webview 4.4. – mtuygun Jul 05 '16 at 19:31
  • I am getting error on console below: – mtuygun Jul 06 '16 at 04:13
  • Did anyone find a solution? I too am having the same problem. Once logged into Twitter while inside the webview, tweets don't show. Scrolling down, then up slowly and some will show for a second then disappear. If I log out, the tweets show up fine. html5test.com shows the webview is "Chromium WebView 43" on my Samsung S7. – Brian Crider Aug 11 '16 at 21:55
  • [Sometimes this link may help](https://androidride.com/android-webview-example-tutorial-kotlin-java-download-source-code/) ... – Athira Reddy Dec 04 '19 at 05:34

1 Answers1

2

You must set layout_width and layout_height attributes like below.

android:layout_width="match_parent"
android:layout_height="match_parent" 
mtuygun
  • 113
  • 1
  • 8