简体   繁体   中英

Is it possible to block screen capture on certain parts of the screen?

To disable screen capturing we can use:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);

Is possible to use something similar to hide views?

For example:

[imageview]

[hidden content]

[text view]

Not really.

The system-supplied solution, FLAG_SECURE , is by window, not by View . Most views draw only in the activity's window. Some views conditionally use a second window, such as the drop-down of a Spinner , but you do not control those windows either.

In principle, if the views that you wanted to block from screenshots were contiguous, you could set up your own window, put the views in that window, and use FLAG_SECURE only on that window. This is likely to be complex and is likely to cause other sorts of problems (eg, multi-window devices, accessibility).

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