在做Android的开发的时候,在ListView 或是 GridView中需要加载大量的图片,为了避免加载过多的图片引起OutOfMemory错误,设置了一个图片缓存列表 Map<String, SoftReference<Bitmap>> imageCache , 并对其进行维护,在图片加载到一定数量的时候,就手动回收掉之前加载图片的bitmap,此时就引起了如下错误: java.lang.RuntimeException: Canvas: trying to use a re…
今天介绍一下Android中怎么实现ImageView的缩放和移动,自定义TouchImageView. public class TouchImageView extends ImageView { Matrix matrix; // We can be in one of these 3 states ; ; ; int mode = NONE; // Remember some things for zooming PointF last = new PointF(); PointF st…