gpt4 book ai didi

java - 从 Android 7 开始,WebView 显示空白页面

转载 作者:太空宇宙 更新时间:2023-11-04 11:10:44 24 4
gpt4 key购买 nike

下面的代码在 Android 7 之前的设备上运行良好。对于 Android 7 和 8,WebView 显示空白屏幕而不是某些内容:

java部分:

public static class QuickIntroFragment1 extends Fragment{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.layout_web_view, container, false);
WebView wv = (WebView) view.findViewById(R.id.wv_intro);
wv.loadUrl("file:///android_res/raw/learn_methodology.html");
return view;
}
}

AndroidManifest 已包含必要的权限:

<uses-permission android:name="android.permission.INTERNET" />

本地 html 部分如下,但其他网址(例如 google.com)也未显示:

    <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Word Dolphin documentation</title>
<style type="text/css">
ul{
margin-left:-17px;
}
</style>
</head>
<body>
<p>Language learning consists of several parts: skill of creating and understanding of sentences, vocabulary filling, pronunciation training and communication skills. Word Dolphin helps to learn words and prevent to forget it.</p>
<ul>
<li>if you want to come to a mutual understanding you need to know about 3000 words. 7-9 thousand words will be sufficient for everyday communication. Where to get these words? Firstly, you can search by phrases similar to "1000 most popular words". Secondly, just read in the learning language. Preferably, these texts on the well-known theme. So, except the most popular words, you obtain living language samples.</li>
<li>after you have found the unknown word, add it to WordDolphin and define translation. In fact, there may be a lot of meanings of the word. But you should learn 3 or 4 most used meanings. Learn it. Optimal quantity is 2 or 3 meanings because more will be difficult to remember. For many languages, Google or Microsoft Translator shows the most used meanings, pronunciation samples, etc.</li>
<li>after you have added unknown words with translations, you can remember them. First learn few words, for example 5, and step by step increase its quantity. The main rule here: they should be easy to remember. It is necessary to listen to pronunciation and try to repeat it. Very good practice to remember words is writing.</li>
<li>finally, check the meaning. It is necessary because learned words will be forgotten fast without practice. Firstly repeat newly learned words, then the rest. Word Dolphin keeps up your skills and based on it will create checklist.</li>
</ul>
<p>For read more tap ☰ and select <b>Info</b>.</p>
<p>Good work!</p>
</body>
</html>

此行为出现在 Google Android 模拟器上。所以this不是我的问题。

最佳答案

这似乎是我的硬件问题,因为使用更强大的硬件和相同的模拟图像,我没有观察到这个错误。

关于java - 从 Android 7 开始,WebView 显示空白页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46036296/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com