View DrawingCache

来源:互联网 发布:如何处理tsv数据 编辑:程序博客网 时间:2024/06/05 09:34

ViewGroup在绘制子view时,而外提供了两个方法

void setChildrenDrawingCacheEnabled(boolean enabled)

setChildrenDrawingCacheEnabled方法可以使viewgroup里所有的子view开启cache, setChildrenDrawnWithCacheEnabled使在绘制子view时,若该子view开启了cache, 则使用它的cache进行绘制,从而节省绘制时间。

setChildrenDrawnWithCacheEnabled(boolean enabled)

获取cache通常会占用一定的内存,所以通常不需要的时候有必要对其进行清理,通过destroyDrawingCache或setDrawingCacheEnabled(false)实现。


0 0