Android图片缓存之Lru算法(二)

前言:
上篇我们总结了Bitmap的处理,同时对比了各种处理的效率以及对内存占用大小,点击查看。我们得知一个应用如果使用大量图片就会导致OOM(out of memory),那该如何处理才能近可能的降低oom发生的概率呢?之前我们一直在使用SoftReference软引用,SoftReference是一种现在已经不再推荐使用的方式,因为从 Android 2.3 (API Level 9)开始,垃圾回收器会更倾向于回收持有软引用或弱引用的对象,这让软引用变得不再可靠,所以今天我们来认识一种新的缓存处理算法Lru,然后学习一下基于Lru的Lrucache、DiskLruCache 实现我们的图片缓存。

Lru:
LRU是Least Recently Used 的缩写,翻译过来就是“最近最少使用”,LRU缓存就是使用这种原理实现,简单的说就是缓存一定量的数据,当超过设定的阈值时就把一些过期的数据删除掉,比如我们缓存10000条数据,当数据小于10000时可以随意添加,当超过10000时就需要把新的数据添加进来,同时要把过期数据删除,以确保我们最大缓存10000条,那怎么确定删除哪条过期数据呢,采用LRU算法实现的话就是将最老的数据删掉。

基于LruCache实现内存缓存:
1.)初始化MemoryCache
这里内存缓存的是Drawable 而不是Bitmap 理由是Drawable相对Bitmap来说有很大的内存优势

 int maxMemory = (int) Runtime.getRuntime().maxMemory();//获取系统分配给应用的总内存大小
 int mCacheSize = maxMemory / 8;//设置图片内存缓存占用八分之一
 mMemoryCache = new LruCache<String, Drawable>(mCacheSize) {
  //必须重写此方法,来测量Bitmap的大小
  @Override
  protected int sizeOf(String key, Drawable value) {
  if (value instanceof BitmapDrawable) {
   Bitmap bitmap = ((BitmapDrawable) value).getBitmap();
   return bitmap == null ? 0 : bitmap.getByteCount();
  }
  return super.sizeOf(key, value);
  }
 };

2.)添加一个Drawable到内存缓存

 /**
 * 添加Drawable到内存缓存
 *
 * @param key
 * @param drawable
 */
 private void addDrawableToMemoryCache(String key, Drawable drawable) {
 if (getDrawableFromMemCache(key) == null && drawable != null) {
  mMemoryCache.put(key, drawable);
 }
 }

3.)从内存缓存中获取一个Drawable

 /**
 * 从内存缓存中获取一个Drawable
 *
 * @param key
 * @return
 */
 public Drawable getDrawableFromMemCache(String key) {
 return mMemoryCache.get(key);
 }

4.)从内存缓存中移除一个Drawable

 /**
 * 从内存缓存中移除
 *
 * @param key
 */
 public void removeCacheFromMemory(String key) {
 mMemoryCache.remove(key);
 }

5.)清空内存缓存

 /**
 * 清理内存缓存
 */
 public void cleanMemoryCCache() {
 mMemoryCache.evictAll();
 }

其实Lru缓存机制本质上就是存储在一个LinkedHashMap存储,为了保障插入的数据顺序,方便清理。

基于DiskLruCache实现磁盘缓存:
DiskLruCache类并不是谷歌官方实现,需要自行下载,下载地址:https://github.com/JakeWharton/DiskLruCache

1.)初始化DiskLruCache

 File cacheDir = context.getCacheDir();//指定的是数据的缓存地址
 long diskCacheSize = 1024 * 1024 * 30;//最多可以缓存多少字节的数据
 int appVersion = DiskLruUtils.getAppVersion(context);//指定当前应用程序的版本号
 int valueCount = 1;//指定同一个key可以对应多少个缓存文件
 try {
  mDiskCache = DiskLruCache.open(cacheDir, appVersion, valueCount, diskCacheSize);
 } catch (Exception ex) {
 }

2.)写入一个文件到磁盘缓存

 /**
 * 添加Bitmap到磁盘缓存
 *
 * @param key
 * @param value
 */
 private void addBitmapToDiskCache(String key, byte[] value) {
 OutputStream out = null;
 try {
  DiskLruCache.Editor editor = mDiskCache.edit(key);
  if (editor != null) {
  out = editor.newOutputStream(0);
  if (value != null && value.length > 0) {
   out.write(value);
   out.flush();
   editor.commit();
  } else {
   editor.abort();
  }
  }
  mDiskCache.flush();
 } catch (IOException e) {
  e.printStackTrace();
 } finally {
  DiskLruUtils.closeQuietly(out);
 }
 }

3.)从磁盘缓存中读取Drawable

 /**
 * 从磁盘缓存中获取一个Drawable
 *
 * @param key
 * @return
 */
 public Drawable getDrawableFromDiskCache(String key) {
 try {
  DiskLruCache.Snapshot snapShot = mDiskCache.get(key);
  if (snapShot != null) {
  InputStream is = snapShot.getInputStream(0);
  Bitmap bitmap = BitmapFactory.decodeStream(is);
  Drawable drawable = DiskLruUtils.bitmap2Drawable(bitmap);
  //从磁盘中读取到之后 加入内存缓存
  addDrawableToMemoryCache(key, drawable);
  return drawable;
  }
 } catch (IOException e) {
  e.printStackTrace();
 }
 return null;
 }

4.)从磁盘缓存中移除

 /**
 * 从磁盘缓存中移除
 *
 * @param key
 */
 public void removeCacheFromDisk(String key) {
 try {
  mDiskCache.remove(key);
 } catch (Exception e) {
 }
 }

5.)清空磁盘缓存

 /**
 * 清理磁盘缓存
 */
 public void cleanDiskCache() {
 try {
  mDiskCache.delete();
 } catch (Exception e) {
 }
 }

图片下载过程:
接下来实例中用到了一点RxJava的知识有不了解RxJava的请自行了解一下。 
1.)采用异步方式操作磁盘缓存和网络下载, 内存缓存可以在主线程中操作

 public void disPlay(final ImageView imageView, String imageUrl) {
  //生成唯一key
  final String key = DiskLruUtils.hashKeyForDisk(imageUrl);
  //先从内存中读取
  Drawable drawableFromMemCache = getDrawableFromMemCache(key);
  if (drawableFromMemCache != null) {
   imageView.setImageDrawable(drawableFromMemCache);
   return;
  }
  Observable.just(imageUrl)
    .map(new Func1<String, Drawable>() {
     @Override
     public Drawable call(String imageUrl) { // 参数类型 String
      //从磁盘中读取
      Drawable drawableFromDiskCache = getDrawableFromDiskCache(key);
      if (drawableFromDiskCache != null) {
       return drawableFromDiskCache;
      }
      //网络下载
      return download(imageUrl); // 返回类型 Drawable
     }
    })
    .subscribeOn(Schedulers.io()) // 指定 subscribe() 发生在 IO 线程
    .observeOn(AndroidSchedulers.mainThread()) // 指定 Subscriber 的回调发生在主线程
    .subscribe(new Action1<Drawable>() {
     @Override
     public void call(Drawable drawable) { // 参数类型 Drawable
      imageView.setImageDrawable(drawable);
     }
    });
 }

2.)下载图片过程以及处理

 private Drawable download(String imageUrl) {
  HttpURLConnection urlConnection = null;
  ByteArrayOutputStream bos = null;
  InputStream ins = null;
  try {
   final URL url = new URL(imageUrl);
   urlConnection = (HttpURLConnection) url.openConnection();
   ins = urlConnection.getInputStream();
   bos = new ByteArrayOutputStream();
   int b;
   while ((b = ins.read()) != -1) {
    bos.write(b);
   }
   bos.flush();
   byte[] bytes = bos.toByteArray();
   Bitmap bitmap = DiskLruUtils.bytes2Bitmap(bytes);
   String key = DiskLruUtils.hashKeyForDisk(imageUrl);
   Drawable drawable = DiskLruUtils.bitmap2Drawable(bitmap);
   //加入内存缓存
   addDrawableToMemoryCache(key, drawable);
   //加入磁盘缓存
   addBitmapToDiskCache(key, bytes);
   return drawable;
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   if (urlConnection != null) {
    urlConnection.disconnect();
   }
   DiskLruUtils.closeQuietly(bos);
   DiskLruUtils.closeQuietly(ins);
  }
  return null;
 }

附上最终图片缓存单例简单实现全部代码以及DiskLruUtils工具类代码
 ImageLoadManager.java

public class ImageLoadManager {
 private LruCache<String, Drawable> mMemoryCache;//内存缓存
 private DiskLruCache mDiskCache;//磁盘缓存
 private static ImageLoadManager mInstance;//获取图片下载单例引用

 /**
  * 构造器
  *
  * @param context
  */
 private ImageLoadManager(Context context) {
  int maxMemory = (int) Runtime.getRuntime().maxMemory();//获取系统分配给应用的总内存大小
  int mCacheSize = maxMemory / 8;//设置图片内存缓存占用八分之一
  mMemoryCache = new LruCache<String, Drawable>(mCacheSize) {
   //必须重写此方法,来测量Bitmap的大小
   @Override
   protected int sizeOf(String key, Drawable value) {
    if (value instanceof BitmapDrawable) {
     Bitmap bitmap = ((BitmapDrawable) value).getBitmap();
     return bitmap == null ? 0 : bitmap.getByteCount();
    }
    return super.sizeOf(key, value);
   }
  };

  File cacheDir = context.getCacheDir();//指定的是数据的缓存地址
  long diskCacheSize = 1024 * 1024 * 30;//最多可以缓存多少字节的数据
  int appVersion = DiskLruUtils.getAppVersion(context);//指定当前应用程序的版本号
  int valueCount = 1;//指定同一个key可以对应多少个缓存文件
  try {
   mDiskCache = DiskLruCache.open(cacheDir, appVersion, valueCount, diskCacheSize);
  } catch (Exception ex) {
  }
 }

 /**
  * 获取单例引用
  *
  * @return
  */
 public static ImageLoadManager getInstance(Context context) {
  ImageLoadManager inst = mInstance;
  if (inst == null) {
   synchronized (RequestManager.class) {
    inst = mInstance;
    if (inst == null) {
     inst = new ImageLoadManager(context.getApplicationContext());
     mInstance = inst;
    }
   }
  }
  return inst;
 }

 public void disPlay(final ImageView imageView, String imageUrl) {
  //生成唯一key
  final String key = DiskLruUtils.hashKeyForDisk(imageUrl);
  //先从内存中读取
  Drawable drawableFromMemCache = getDrawableFromMemCache(key);
  if (drawableFromMemCache != null) {
   imageView.setImageDrawable(drawableFromMemCache);
   return;
  }
  Observable.just(imageUrl)
    .map(new Func1<String, Drawable>() {
     @Override
     public Drawable call(String imageUrl) { // 参数类型 String
      //从磁盘中读取
      Drawable drawableFromDiskCache = getDrawableFromDiskCache(key);
      if (drawableFromDiskCache != null) {
       return drawableFromDiskCache;
      }
      //网络下载
      return download(imageUrl); // 返回类型 Drawable
     }
    })
    .subscribeOn(Schedulers.io()) // 指定 subscribe() 发生在 IO 线程
    .observeOn(AndroidSchedulers.mainThread()) // 指定 Subscriber 的回调发生在主线程
    .subscribe(new Action1<Drawable>() {
     @Override
     public void call(Drawable drawable) { // 参数类型 Drawable
      imageView.setImageDrawable(drawable);
     }
    });
 }

 /**
  * 添加Drawable到内存缓存
  *
  * @param key
  * @param drawable
  */
 private void addDrawableToMemoryCache(String key, Drawable drawable) {
  if (getDrawableFromMemCache(key) == null && drawable != null) {
   mMemoryCache.put(key, drawable);
  }
 }

 /**
  * 从内存缓存中获取一个Drawable
  *
  * @param key
  * @return
  */
 public Drawable getDrawableFromMemCache(String key) {
  return mMemoryCache.get(key);
 }

 /**
  * 从磁盘缓存中获取一个Drawable
  *
  * @param key
  * @return
  */
 public Drawable getDrawableFromDiskCache(String key) {
  try {
   DiskLruCache.Snapshot snapShot = mDiskCache.get(key);
   if (snapShot != null) {
    InputStream is = snapShot.getInputStream(0);
    Bitmap bitmap = BitmapFactory.decodeStream(is);
    Drawable drawable = DiskLruUtils.bitmap2Drawable(bitmap);
    //从磁盘中读取到之后 加入内存缓存
    addDrawableToMemoryCache(key, drawable);
    return drawable;
   }
  } catch (IOException e) {
   e.printStackTrace();
  }
  return null;
 }

 /**
  * 添加Bitmap到磁盘缓存
  *
  * @param key
  * @param value
  */
 private void addBitmapToDiskCache(String key, byte[] value) {
  OutputStream out = null;
  try {
   DiskLruCache.Editor editor = mDiskCache.edit(key);
   if (editor != null) {
    out = editor.newOutputStream(0);
    if (value != null && value.length > 0) {
     out.write(value);
     out.flush();
     editor.commit();
    } else {
     editor.abort();
    }
   }
   mDiskCache.flush();
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   DiskLruUtils.closeQuietly(out);
  }
 }

 private Drawable download(String imageUrl) {
  HttpURLConnection urlConnection = null;
  ByteArrayOutputStream bos = null;
  InputStream ins = null;
  try {
   final URL url = new URL(imageUrl);
   urlConnection = (HttpURLConnection) url.openConnection();
   ins = urlConnection.getInputStream();
   bos = new ByteArrayOutputStream();
   int b;
   while ((b = ins.read()) != -1) {
    bos.write(b);
   }
   bos.flush();
   byte[] bytes = bos.toByteArray();
   Bitmap bitmap = DiskLruUtils.bytes2Bitmap(bytes);
   String key = DiskLruUtils.hashKeyForDisk(imageUrl);
   Drawable drawable = DiskLruUtils.bitmap2Drawable(bitmap);
   //加入内存缓存
   // addDrawableToMemoryCache(key, drawable);
   //加入磁盘缓存
   addBitmapToDiskCache(key, bytes);
   return drawable;
  } catch (IOException e) {
   e.printStackTrace();
  } finally {
   if (urlConnection != null) {
    urlConnection.disconnect();
   }
   DiskLruUtils.closeQuietly(bos);
   DiskLruUtils.closeQuietly(ins);
  }
  return null;
 }

 /**
  * 从缓存中移除
  *
  * @param key
  */
 public void removeCache(String key) {
  removeCacheFromMemory(key);
  removeCacheFromDisk(key);
 }

 /**
  * 从内存缓存中移除
  *
  * @param key
  */
 public void removeCacheFromMemory(String key) {
  mMemoryCache.remove(key);
 }

 /**
  * 从磁盘缓存中移除
  *
  * @param key
  */
 public void removeCacheFromDisk(String key) {
  try {
   mDiskCache.remove(key);
  } catch (Exception e) {
  }
 }

 /**
  * 磁盘缓存大小
  *
  * @return
  */
 public long diskCacheSize() {

  return mDiskCache.size();
 }

 /**
  * 内存缓存大小
  *
  * @return
  */
 public long memoryCacheSize() {

  return mMemoryCache.size();
 }

 /**
  * 关闭磁盘缓存
  */
 public void closeDiskCache() {
  try {
   mDiskCache.close();
  } catch (Exception e) {
  }
 }

 /**
  * 清理缓存
  */
 public void cleanCache() {
  cleanMemoryCCache();
  cleanDiskCache();
 }

 /**
  * 清理磁盘缓存
  */
 public void cleanDiskCache() {
  try {
   mDiskCache.delete();
  } catch (Exception e) {
  }
 }

 /**
  * 清理内存缓存
  */
 public void cleanMemoryCCache() {
  mMemoryCache.evictAll();
 }
}

DiskLruUtils.java

final class DiskLruUtils {

 /**
  * 关闭输入输出流
  */
 public static void closeQuietly(/*Auto*/Closeable closeable) {
  if (closeable != null) {
   try {
    closeable.close();
   } catch (RuntimeException rethrown) {
    throw rethrown;
   } catch (Exception ignored) {
   }
  }
 }

 /**
  * 获取versionCode
  */
 public static int getAppVersion(Context context) {
  try {
   PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
   return info.versionCode;
  } catch (PackageManager.NameNotFoundException e) {
   e.printStackTrace();
  }
  return 1;
 }

 public static String hashKeyForDisk(String key) {
  String cacheKey;
  try {
   final MessageDigest mDigest = MessageDigest.getInstance("MD5");
   mDigest.update(key.getBytes());
   cacheKey = bytesToHexString(mDigest.digest());
  } catch (NoSuchAlgorithmException e) {
   cacheKey = String.valueOf(key.hashCode());
  }
  return cacheKey;
 }

 public static String bytesToHexString(byte[] bytes) {
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < bytes.length; i++) {
   String hex = Integer.toHexString(0xFF & bytes[i]);
   if (hex.length() == 1) {
    sb.append('0');
   }
   sb.append(hex);
  }
  return sb.toString();
 }

 /**
  * Bitmap → bytes
  */
 public static byte[] bitmap2Bytes(Bitmap bm) {
  if (bm == null) {
   return null;
  }
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
  return baos.toByteArray();
 }

 /**
  * bytes → Bitmap
  */
 public static Bitmap bytes2Bitmap(byte[] bytes) {
  return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
 }

 /**
  * Drawable → Bitmap
  */
 public static Bitmap drawable2Bitmap(Drawable drawable) {
  if (drawable == null) {
   return null;
  }
  // 取 drawable 的长宽
  int w = drawable.getIntrinsicWidth();
  int h = drawable.getIntrinsicHeight();
  // 取 drawable 的颜色格式
  Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
  // 建立对应 bitmap
  Bitmap bitmap = Bitmap.createBitmap(w, h, config);
  // 建立对应 bitmap 的画布
  Canvas canvas = new Canvas(bitmap);
  drawable.setBounds(0, 0, w, h);
  // 把 drawable 内容画到画布中
  drawable.draw(canvas);
  return bitmap;
 }

 /*
   * Bitmap → Drawable
   */
 public static Drawable bitmap2Drawable(Bitmap bm) {
  if (bm == null) {
   return null;
  }
  BitmapDrawable bd = new BitmapDrawable(bm);
  bd.setTargetDensity(bm.getDensity());
  return new BitmapDrawable(bm);
 }

}

以上就是基于Lru图片缓存简单实现,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • Android实现图片缓存与异步加载

    ImageManager2这个类具有异步从网络下载图片,从sd读取本地图片,内存缓存,硬盘缓存,图片使用动画渐现等功能,已经将其应用在包含大量图片的应用中一年多,没有出现oom. Android程序常常会内存溢出,网上也有很多解决方案,如软引用,手动调用recycle等等.但经过我们实践发现这些方案,都没能起到很好的效果,我们的应用依然会出现很多oom,尤其我们的应用包含大量的图片.android3.0之后软引用基本已经失效,因为虚拟机只要碰到软引用就回收,所以带不来任何性能的提升. 我这里的解

  • Android图片缓存之Bitmap详解(一)

    前言: 最近准备研究一下图片缓存框架,基于这个想法觉得还是先了解有关图片缓存的基础知识,今天重点学习一下Bitmap.BitmapFactory这两个类.  Bitmap: Bitmap是Android系统中的图像处理的最重要类之一.用它可以获取图像文件信息,进行图像剪切.旋转.缩放等操作,并可以指定格式保存图像文件.  重要函数  •public void recycle() // 回收位图占用的内存空间,把位图标记为Dead  •public final boolean isRecycled

  • android异步加载图片并缓存到本地实现方法

    在android项目中访问网络图片是非常普遍性的事情,如果我们每次请求都要访问网络来获取图片,会非常耗费流量,而且图片占用内存空间也比较大,图片过多且不释放的话很容易造成内存溢出.针对上面遇到的两个问题,首先耗费流量我们可以将图片第一次加载上面缓存到本地,以后如果本地有就直接从本地加载.图片过多造成内存溢出,这个是最不容易解决的,要想一些好的缓存策略,比如大图片使用LRU缓存策略或懒加载缓存策略.今天首先介绍一下本地缓存图片. 首先看一下异步加载缓存本地代码: 复制代码 代码如下: public

  • android中图片的三级缓存cache策略(内存/文件/网络)

    1.简介 现在android应用中不可避免的要使用图片,有些图片是可以变化的,需要每次启动时从网络拉取,这种场景在有广告位的应用以及纯图片应用(比如百度美拍)中比较多. 现在有一个问题:假如每次启动的时候都从网络拉取图片的话,势必会消耗很多流量.在当前的状况下,对于非wifi用户来说,流量还是很贵的,一个很耗流量的应用,其用户数量级肯定要受到影响.当然,我想,向百度美拍这样的应用,必然也有其内部的图片缓存策略.总之,图片缓存是很重要而且是必须的. 2.图片缓存的原理 实现图片缓存也不难,需要有相

  • 直接应用项目中的Android图片缓存技术

    前不久搞的Android图片缓存,刚开始引入开源的框架,用着还行,但是在开发中遇到问题,就比如universal-image-loader-1.9.5.jar这个框架吧,在加载图片的时候自定义imageview无法加载,可能是存在以下问题吧,况且导入框架导致开发的项目包越来越大,基于上面的这几种情况,于是我就想自己写一个图片三级缓存的工具. 简要分析:刚开始想,图片的加载显示无非是先检查内存里面有没有,没就去文件里面找,若是文件里面没有的话就去开启网络下载,这样也符合开发中的大部分需求,而且效率

  • Android图片缓存之初识Glide(三)

    前言: 前面总结学习了图片的使用以及Lru算法,今天来学习一下比较优秀的图片缓存开源框架.技术本身就要不断的更迭,从最初的自己使用SoftReference实现自己的图片缓存,到后来做电商项目自己的实现方案不能满足项目的需求改用Afinal,由于Afinal不再维护而选择了师出同门的Xutils,中间也接触过别的开源框架比如Picasso,对Picasso的第一次印象就不太好,初次接触是拿到了公司刚从外包公司接手过来的图片社交类app,对内存占用太大,直接感受就是导致ListView滑动有那么一

  • Android开发笔记之图片缓存、手势及OOM分析

    把图片缓存.手势及OOM三个主题放在一起,是因为在Android应用开发过程中,这三个问题经常是联系在一起的.首先,预览大图需要支持手势缩放,旋转,平移等操作:其次,图片在本地需要进行缓存,避免频繁访问网络:最后,图片(Bitmap)是Android中占用内存的大户,涉及高清大图等处理时,内存占用非常大,稍不谨慎,系统就会报OOM错误. 庆幸的是,这三个主题在Android开发中属于比较普遍的问题,有很多针对于此的通用的开源解决方案.因此,本文主要说明笔者在开发过程中用到的一些第三方开源库.主要

  • Android图片缓存原理、特性对比

    这是我在 MDCC 上分享的内容(略微改动),也是源码解析第一期发布时介绍的源码解析后续会慢慢做的事. 从总体设计和原理上对几个图片缓存进行对比,没用到他们的朋友也可以了解他们在某些特性上的实现. 一. 四大图片缓存基本信息 Universal ImageLoader 是很早开源的图片缓存,在早期被很多应用使用. Picasso 是 Square 开源的项目,且他的主导者是 JakeWharton,所以广为人知. Glide 是 Google 员工的开源项目,被一些 Google App 使用,

  • android上的一个网络接口和图片缓存框架enif简析

    1.底层网络接口采用apache的httpclient连接池框架: 2.图片缓存采用基于LRU的算法: 3.网络接口采用监听者模式: 4.包含图片的OOM处理(及时回收处理技术的应用): 图片核心处理类:CacheView.java 复制代码 代码如下: package xiaogang.enif.image; import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; imp

  • Android中Glide加载库的图片缓存配置究极指南

    零.选择Glide 为什么图片加载我首先推荐Glide? 图片加载框架用了不少,从afinal框架的afinalBitmap,Xutils的BitmapUtils,老牌框架universalImageLoader,著名开源组织square的picasso,google推荐的glide到FaceBook推出的fresco.这些我前前后后都体验过,那么面对这么多的框架,该如何选择呢?下面简单分析下我的看法. afinal和Xuils在github上作者已经停止维护了,开源社区最新的框架要属KJFra

随机推荐