微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Blogger API检索WebView中特定的发布后加载内容

如何解决Blogger API检索WebView中特定的发布后加载内容

我正在使用Retrieving posts from a blog的Blogger API,从此API调用的响应来看,有一个名为content的键,其中包含该帖子的HTML代码,我正尝试将该HTML加载到WebView,但是问题在于它没有加载WebView中的所有内容。这是在WebView中加载HTML的代码

webView.loadData(content,"text/html","UTF-8");

在上述代码段中,content一个String类型的变量,包含完整的网页HTML代码

API的响应:

{
      "kind": "blogger#post","id": "589230665373284492","blog": {
        "id": "3332972326669427275"
      },"published": "2020-10-17T19:20:00-07:00","updated": "2020-10-17T23:54:37-07:00","url": "http://devofandroid.blogspot.com/2020/10/picture-in-picture-android-studio-kotlin.html","selfLink": "https://www.googleapis.com/blogger/v3/blogs/3332972326669427275/posts/589230665373284492","title": "Picture In Picture | Android Studio | Kotlin",2020-10-25 08:09:45.938 26635-26635/com.blogspot.atifsoftwares.blogger D/POST_DETAILS_TAG:   "content": "\u003cp\u003e\u003c/p\u003e\u003ch1 style=\"text-align: left;\"\u003eHow to add Picture In Picture Mode in the android app?\u003c/h1\u003e\u003cp style=\"text-align: justify;\"\u003eThe Android 8.0 (API level 26) allows activities to launch in the picture-in-picture (PIP) mode. PIP is a special type of multi-window mode mostly used for video playback. It lets the user watch a video in a small window pinned to a corner of the screen while navigating between apps or browsing content on the main screen. The PIP window appears in the top layer of the screen in a corner chosen by the system.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003e\u003ca href=\"https://devofandroid.blogspot.com/2020/10/picture-in-picture-android-studio-java.html\"\u003e>>Check For Java\u003c/a\u003e\u003c/p\u003e\u003ch4 style=\"text-align: left;\"\u003eVideo:\u003c/h4\u003e\u003cdiv\u003e\n\u003ciframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/mnaePNH9V3k\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003c/div\u003e\u003ch4 style=\"background-color: white; color: #4d4d4d; font-family: Roboto,sans-serif; font-size: 15px; text-align: justify;\"\u003eStep 1: \u003ca href=\"http://devofandroid.blogspot.com/2018/03/first-app-in-android-studio-kotlin-use.html\" style=\"background: transparent; color: #d80b0b; outline: 0px; text-decoration-line: none;\"\u003eCreate a new project\u003c/a\u003e\u003cspan face=\"roboto,sans-serif\"\u003e \u003c/span\u003e\u003cspan face=\"roboto,sans-serif\"\u003eor\u003c/span\u003e\u003cspan face=\"roboto,sans-serif\"\u003e \u003c/span\u003e\u003ca href=\"http://devofandroid.blogspot.com/2018/03/how-to-open-existing-project-in-android.html\" style=\"background: transparent; color: #d80b0b; text-decoration-line: none;\"\u003eopen an existing project\u003c/a\u003e\u003c/h4\u003e\u003ch4 style=\"background-color: white; color: #4d4d4d; font-family: Roboto,sans-serif; font-size: 15px; text-align: justify;\"\u003eStep 2: Create another activity named PIPActivity\u003c/h4\u003e\u003ch4 style=\"background-color: white; color: #4d4d4d; font-family: Roboto,sans-serif; font-size: 15px; text-align: justify;\"\u003e\u003cspan face=\"roboto,sans-serif\" style=\"background-color: transparent; color: #111111; text-align: left;\"\u003e\u003cspan style=\"font-size: 14px; white-space: pre-wrap;\"\u003eStep 3: Add the following properties to the \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"background-color: transparent; text-align: left;\"\u003ePIPActivity in AndroidManifest\u003c/span\u003e\u003c/h4\u003e\u003cdiv\u003e\u003cspan style=\"background-color: transparent; text-align: left;\"\u003e\n  \u003cdiv style=\"background: rgb(255,255,255); border-color: gray; border-image: initial; border-style: solid; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;\"\u003e\u003cpre style=\"line-height: 125%; margin: 0px;\"\u003e\u003cspan style=\"color: #007700;\"\u003e<activity\u003c/span\u003e \u003cspan style=\"color: #0000cc;\"\u003eandroid:name=\u003c/span\u003e\u003cspan style=\"background-color: #fff0f0;\"\u003e\".PIPActivity\"\u003c/span\u003e\n            \u003cspan style=\"color: #0000cc;\"\u003eandroid:configChanges=\u003c/span\u003e\u003cspan style=\"background-color: #fff0f0;\"\u003e\"screenSize|smallestScreenSize|screenLayout|orientation\"\u003c/span\u003e\n            \u003cspan style=\"color: #0000cc;\"\u003eandroid:launchMode=\u003c/span\u003e\u003cspan style=\"background-color: #fff0f0;\"\u003e\"singleTask\"\u003c/span\u003e\n            \u003cspan style=\"color: #0000cc;\"\u003eandroid:resizeableActivity=\u003c/span\u003e\u003cspan style=\"background-color: #fff0f0;\"\u003e\"true\"\u003c/span\u003e\n            \u003cspan style=\"color: #0000cc;\"\u003eandroid:supportsPictureInPicture=\u003c/span\u003e
2020-10-25 08:09:45.938 26635-26635/com.blogspot.atifsoftwares.blogger D/POST_DETAILS_TAG:   "author": {
        "id": "07474932866787621864","displayName": "Atif Pervaiz","url": "https://www.blogger.com/profile/07474932866787621864","image": {
          "url": "//2.bp.blogspot.com/-9c4mLBCE9Q0/X4uslXybcjI/AAAAAAAAKeg/mMtVYJGLDTM2dHrOj5ULHRa_BvSQ1z7OgCK4BGAYYCw/s35/B612_20200913_170020_321.jpg"
        }
      },"replies": {
        "totalItems": "0","selfLink": "https://www.googleapis.com/blogger/v3/blogs/3332972326669427275/posts/589230665373284492/comments"
      },"labels": [
        "android","android 8","android O","android studio","Kotlin","picture in picture","picture in picture mode","pip","pip mode","tutorial"
      ],"etag": "\"dGltZXN0YW1wOiAxNjAzMDA0MDc3NzQxCm9mZnNldDogLTI1MjAwMDAwCg\""
    }

Here is a screenshot,that shows there is no more data after Youtube Video.

解决方法

您可以尝试使用iframe 您可以参考文档here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。