WebView is not loading page in Android 9.0?

后端 未结 7 1663
时光说笑
时光说笑 2020-12-03 05:24
 public abstract class MainActivity extends AppCompatActivity {

        private static WebView web;
        private WebView mWebView;
        private java.lang.Stri         


        
7条回答
  •  广开言路
    2020-12-03 05:54

    Same issue occurred in my project but all of the above answers not worked for me. so after wasting a whole day on this issue,what i got is

    In Android version 8.1/9/10 if your are using wrap_content attribute for height in WebView ,then it will always set to 0dp. In earlier versions(below 8.1) wrap_content in WebView works fine. but from 8.1 and above you can give height either statically or you can set it dynamically through program using setLayoutParameters(). And also add extra attribute to Application ( android:usesCleartextTraffic="true" ) in android manifest.

提交回复
热议问题