【发布时间】:2011-08-01 07:32:13
【问题描述】:
从 ScrollView 滚动出来的视图是否由绘图缓存自动缓存?我不太确定我是否理解 API 文档。
【问题讨论】:
标签: android caching listview scroll scrollview
从 ScrollView 滚动出来的视图是否由绘图缓存自动缓存?我不太确定我是否理解 API 文档。
【问题讨论】:
标签: android caching listview scroll scrollview
int PERSISTENT_ALL_CACHES用来表示所有的绘图缓存都应该保存在内存中。
int PERSISTENT_ANIMATION_CACHE用于表示动画绘制缓存应该保存在内存中。
int PERSISTENT_NO_CACHE 用于表示内存中不应保留绘图缓存。
int PERSISTENT_SCROLLING_CACHE用来表示滚动绘图缓存应该保存在内存中。
在
中使用这些public void setPersistentDrawingCache (int drawingCacheToKeep)
这表示创建后应将哪些类型的绘图缓存保存在内存中。
示例
setPersistentDrawingCache(ViewGroup.PERSISTENT_SCROLLING_CACHE);
setAlwaysDrawnWithCacheEnabled(true); // call this method
//to start (true) and stop (false) using the drawing cache
//when you perform performance sensitive operations, like scrolling or animating.
【讨论】: