Android gives a screenshot of Scrollview that exceeds the screen size

Many times, we want to share all the contents of an interface, but there are too many contents that exceed the size of the screen. Simple screenshots can no longer meet our needs. At this time, we can intercept pictures according to the height of the Scrollview in the layout.

The code is as follows:

Call getbitmapbyview() method where necessary:

However, if you write this way, you will sometimes report an OUTOFMEMORY error because the captured image is too long and too large. Therefore, in order to avoid memory overflow and program crash, you should pay attention to using config.rgb_ 565, better than ARGB_ 8888 takes up less memory. Another thing is to compress the picture. At least I didn't report the error of oom, that is:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>