搬砖日记

搬砖日记

The correct way to take screenshots of Android Views

Screenshots#

Method 1:

Issue#

The above are all methods for capturing screenshots of views. However, sometimes there is a situation where the screenshot remains the same even after the view has changed. In this case, you need to refresh the view's drawing cache. For example, the big pit mentioned in Method 3 is that you need to call view.destroyDrawingCache() before the next call. Or if you have called the setDrawingCacheEnabled(true) method, you need to call setDrawingCacheEnabled(false) after you finish using it.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.