简体   繁体   中英

Android screen shot

I wanted to take screen shots from the android screen with a floating button. I made the floating button and it takes screen shots and everything works well but there are two questions 1. How can my app take screenshot in a way that the floating button gets hidden then appears after the screen shot has been taken in order not to bother the user 2. When you press the volume down and power key to take screenshot, it has a great animation. How can i add that animation?

Add it in your java file

View b = findViewById(R.id.button); 
b.setVisibility(View.GONE);

Get your button's view, and just before taking the screenshot, hide it and unhide it after you are done taking the screenshot in the floating button's onClick method.

findViewById(R.id.floating_button).setVisibility(View.INVISIBLE);
// Take screenshot here
findViewById(R.id.floating_button).setVisibility(View.VISIBLE);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM