91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

WebView顯示h5圖片并點擊放大過多后的內存泄漏問題

發布時間:2020-07-21 22:37:29 來源:網絡 閱讀:1274 作者:guozhendan 欄目:移動開發

    最近在項目開發中用webview去顯示加載h6內容,而h6內容中有一些圖片,并且可以點擊放大看圖。在比較變態的測試方法(點擊圖片放大,關閉當前界面,再進入,再點擊圖片放大,大概10次左右)后,會導致圖片點擊沒反映了(其實就是webview內存泄漏了)。錯誤信息如下:

12-02 10:46:19.824: E/Surface(19632): dequeueBuffer failed (Invalid argument)

12-02 10:46:19.824: E/ViewRootImpl(19632): Could not lock surface

12-02 10:46:19.824: E/ViewRootImpl(19632): java.lang.IllegalArgumentException

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Surface.nativeLockCanvas(Native Method)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Surface.lockCanvas(Surface.java:244)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2474)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2448)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2292)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1922)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1039)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5648)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Choreographer.doCallbacks(Choreographer.java:574)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Choreographer.doFrame(Choreographer.java:544)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.os.Handler.handleCallback(Handler.java:733)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.os.Handler.dispatchMessage(Handler.java:95)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.os.Looper.loop(Looper.java:136)

12-02 10:46:19.824: E/ViewRootImpl(19632): at android.app.ActivityThread.main(ActivityThread.java:5047)

12-02 10:46:19.824: E/ViewRootImpl(19632): at java.lang.reflect.Method.invokeNative(Native Method)

12-02 10:46:19.824: E/ViewRootImpl(19632): at java.lang.reflect.Method.invoke(Method.java:515)

12-02 10:46:19.824: E/ViewRootImpl(19632): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

12-02 10:46:19.824: E/ViewRootImpl(19632): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)

12-02 10:46:19.824: E/ViewRootImpl(19632): at dalvik.system.NativeStart.main(Native Method)

12-02 10:46:19.834: E/JavaBinder(19632): !!! FAILED BINDER TRANSACTION !!!


話不多說了,直接分享一下解決方法吧!

1、在初始化時,customWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

2、在Activity的onDestroy時,添加下面兩句話:

    customWebView.removeAllViews();

    customWebView.destroy();



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

自贡市| 株洲市| 广水市| 柘城县| 咸宁市| 饶阳县| 罗田县| 基隆市| 平湖市| 兴安县| 右玉县| 晋江市| 乐至县| 黄龙县| 峨山| 岳普湖县| 肇东市| 南通市| 鄂尔多斯市| 通许县| 虹口区| 衢州市| 五莲县| 兴安盟| 洞头县| 温宿县| 新野县| 英吉沙县| 新源县| 永丰县| 武隆县| 大庆市| 正定县| 通许县| 曲松县| 罗山县| 泽普县| 肃宁县| 稻城县| 牟定县| 嘉义市|