destroyDrawingCache
void destroyDrawingCache ()
Frees the resources used by the drawing cache. If you call buildDrawingCache()
manually without calling setDrawingCacheEnabled(true)
, you should cleanup the cache with this method afterwards.释放的资源使用的绘图缓存。如果你调用buildDrawingCache()手动没有调用setDrawingCacheEnabled(真正的),你应该清理缓存使用此方法。
See also:
setDrawingCacheEnabled
void setDrawingCacheEnabled (boolean enabled)
Enables or disables the drawing cache. When the drawing cache is enabled, the next call to getDrawingCache()
or buildDrawingCache()
will draw the view in a bitmap. Calling draw(android.graphics.Canvas)
will not draw from the cache when the cache is enabled. To benefit from the cache, you must request the drawing cache by calling getDrawingCache()
and draw it on screen if the returned bitmap is not null.启用或禁用绘图缓存。启用绘图缓存时,下一个调用getDrawingCache()或buildDrawingCache()将一个位图中的视图。调用画(android.graphics.Canvas)不会从缓存启用缓存时。从缓存中获益,您必须请求绘图缓存通过调用getDrawingCache()和画在屏幕上返回的位图(如果不为空。
Enabling the drawing cache is similar to setting a layer
when hardware acceleration is turned off. When hardware acceleration is turned on, enabling the drawing cache has no effect on rendering because the system uses a different mechanism for acceleration which ignores the flag. If you want to use a Bitmap for the view, even when hardware acceleration is enabled, see setLayerType(int, android.graphics.Paint)
for information on how to enable software and hardware layers.使绘图缓存类似于当关闭硬件加速设置一层。当开启硬件加速,使绘图缓存对渲染,因为没有影响系统使用不同的机制来加速它忽略了国旗。如果你想使用一个位图的观点,即使启用硬件加速,看到setLayerType(int,android.graphics.Paint)如何启用软件和硬件层的信息。
This API can be used to manually generate a bitmap copy of this view, by setting the flag to true
and calling getDrawingCache()
.
Parameters | |
---|---|
enabled | boolean : true to enable the drawing cache, false otherwise |
See also:
isDrawingCacheEnabled
boolean isDrawingCacheEnabled ()
Indicates whether the drawing cache is enabled for this view.显示绘图缓存是否支持这一观点。
Returns | |
---|---|
boolean | true if the drawing cache is enabled |
buildDrawingCache
void buildDrawingCache ()
Calling this method is equivalent to calling buildDrawingCache(false)
.调用该方法相当于调用buildDrawingCache(假)。
See also:
getDrawingCache
Bitmap getDrawingCache ()
Calling this method is equivalent to calling getDrawingCache(false)
.
Returns | |
---|---|
Bitmap | A non-scaled bitmap representing this view or null if cache is disabled. |
See also: