对View DrawingCache的理解
来源:互联网 发布:微信一键清理好友软件 编辑:程序博客网 时间:2024/06/03 12:29
void setDrawingCacheEnabled(boolean flag),
Bitmap getDrawingCache(boolean autoScale),
void buildDrawingCache(boolean autoScale),
void destroyDrawingCache()
我们要获取它的cache先要通过setDrawingCacheEnable方法把cache开启,然后再调用getDrawingCache方法就可 以获得view的cache图片了。buildDrawingCache方法可以不用调用,因为调用getDrawingCache方法时,若果 cache没有建立,系统会自动调用buildDrawingCache方法生成cache。若果要更新cache, 必须要调用destoryDrawingCache方法把旧的cache销毁,才能建立新的。
当调用setDrawingCacheEnabled方法设置为false, 系统也会自动把原来的cache销毁。
ViewGroup在绘制子view时,而外提供了两个方法
void setChildrenDrawingCacheEnabled(boolean enabled)
setChildrenDrawnWithCacheEnabled(boolean enabled)
setChildrenDrawingCacheEnabled方法可以使viewgroup里所有的子view开启cache, setChildrenDrawnWithCacheEnabled使在绘制子view时,若该子view开启了cache, 则使用它的cache进行绘制,从而节省绘制时间。
获取cache通常会占用一定的内存,所以通常不需要的时候有必要对其进行清理,通过destroyDrawingCache或setDrawingCacheEnabled(false)实现。
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解
- 对View DrawingCache的理解(转)
- Android开发:对View DrawingCache的理解
- 【android】对View DrawingCache的理解
- Android开发:对View DrawingCache的理解
- Offsetof
- Visual Assist X快捷键
- java中byte数组与int,long,short间的转换
- CHAR与WCHAR处理函数
- Java程序设计 实验3
- 对View DrawingCache的理解
- vs2010中臃肿的IPCH和SDF文件
- 黑马程序员-数据库中 join的用法
- 无法引用Microsoft.Office.Interop.Excel的解决
- 【斜率优化DP】玩具装箱
- win7 打开chm问题
- myeclipse搭建extjs4.0.7
- BOOST+STLport
- 黑马程序员-基础学习之day3-day4(break和continue引发的“血案”)