问题
I am working on an app in which I have some edit texts and background image. I wrote something in that edit text, I want to save whole current screen as an image, so that I can send it via email. I got a solution using ASL(android screenshot library) but for this I have to start native service on my device every time when I reboot it. So is there any other solution to take screenshot of current screen?
回答1:
Try this.. find the Parent layout in you xml and do this.
LinearLayout ll = (LinearLayout )findViewById(R.id.layout);
ll .setDrawingCacheEnabled(true);
Bitmap bm = v1.getDrawingCache();
来源:https://stackoverflow.com/questions/6815573/programmatically-taking-screenshot-of-current-screen-in-android-device