从android.view.GLES20DisplayList释放位图 [英] Release bitmaps from android.view.GLES20DisplayList

查看:264
本文介绍了从android.view.GLES20DisplayList释放位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何从android.view.GLES20DisplayList释放位图。 为什么它让他们活着,即使你清洁,手工比方说,ImageView的? 或者,也许有一种方法来禁用GLES20DisplayList,试图使用Android的:在AndroidManifest hardwareAccelerated =false时,仍然没有运气

看起来只影响在4.2(1)

更新:(?错误)看起来你无法禁用4.2.1硬件加速

简单的测试:

  Android清单:
应用...机器人:hardwareAccelerated =假

的System.out.println(isHardwareAccelerated:+ mListView.isHardwareAccelerated());
mListView.setLayerType(LAYER_TYPE_SOFTWARE,NULL);
的System.out.println(isHardwareAccelerated:+ mListView.isHardwareAccelerated());
 

结果:

  12-06 17:15:27.129:我/的System.out(30752):isHardwareAccelerated:真
12-06 17:15:27.129:我/的System.out(30752):isHardwareAccelerated:真
 

解决方案

我最近做了关于这个问题的深入内存分析。由于尤利娅上文所指出的,禁用硬件加速会做一般的伎俩。另外,您也可以设置的ImageView绘制对象为null,回收的位图,或分离的ImageView为你指出。

然而,根据该API的版本,所述位图存储器可以或可以不被释放从GLES20DisplayList。我讨论了的我的博客文章 - Android的位图内存分析,但快速的解决办法是禁用硬件加速

Is anyone knows how to Release bitmaps from android.view.GLES20DisplayList. And why it keeps them alive even if you clean, let's say, ImageView manually? Or maybe there is a way to disable GLES20DisplayList, tried to use android:hardwareAccelerated="false" in AndroidManifest, still no luck.

Looks like affected only in 4.2(1)

update: looks like you can't disable hardware acceleration on 4.2.1 (bug?)

simple test:

Android manifest:
application ... android:hardwareAccelerated="false"

System.out.println("isHardwareAccelerated: " + mListView.isHardwareAccelerated());
mListView.setLayerType(LAYER_TYPE_SOFTWARE, null);
System.out.println("isHardwareAccelerated: " + mListView.isHardwareAccelerated());

result:

12-06 17:15:27.129: I/System.out(30752): isHardwareAccelerated: true
12-06 17:15:27.129: I/System.out(30752): isHardwareAccelerated: true

解决方案

I recently did an in-depth memory analysis regarding this issue. As Yulia pointed out above, disabling hardware acceleration would do the trick in general. Alternatively, you can set the ImageView’s Drawable to null, recycle the bitmap, or detach the ImageView as you pointed out.

However, depending on the API version, the bitmap memory may or may not be released from GLES20DisplayList. I discussed these different behaviors and possible solutions in-depth on my blog post – Android Bitmap Memory Analysis, but the quick solution would be to disable hardware acceleration.

这篇关于从android.view.GLES20DisplayList释放位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆