reprinted from: Http://blog.sina.com.cn/s/blog_4b93170a0102e40m.htmlthe content displayed by the view component can be saved as bitmap through the cache mechanism, mainly in the following ways:
void Setdrawingcacheenabled (Boolean flag),
Bitmap Getdrawingcache (boolean autoscale),
void Builddrawingcache (Boolean autoscale),
void Destroydrawingcache () we need to get the cache first by using the Setdrawingcacheenable method to open the cache and then call the Getdrawingcache method to get the cache image of the view. the Builddrawingcache method can not be called, because when the Getdrawingcache method is called, the system automatically calls the Builddrawingcache method to generate the cache if the cache is not established. To update the cache, you must call the Destorydrawingcache method to destroy the old cache to create a new. when the call setdrawingcacheenabled method is set to False, the system will automatically destroy the original cache. In addition, ViewGroup also provides two methods when drawing sub-view
void Setchildrendrawingcacheenabled (Boolean enabled)
setchildrendrawnwithcacheenabled (Boolean enabled) The setchildrendrawingcacheenabled method allows all sub-view in the ViewGroup to open the cache; Setchildrendrawnwithcacheenabled allows you to draw a child view by using its cache if the child view opens the cache, saving drawing time. getting the cache usually consumes a certain amount of memory, so it is often necessary to clean it up when it is not needed, by Destroydrawingcache or setdrawingcacheenabled (false).
Use of view class Drawingcache in Android