Andriod prevents screenshots

Source: Internet
Author: User

WindowManager. LayoutParams is a nested class of the WindowManager interface. It inherits from ViewGroup. LayoutParams and is used to describe Window management policies to WindowManager.
Major member Constants
Window flag Series
This series is mainly used to set the flag of the Window. If you set the flag of a Window, you can directly get its WindowManager. LayoutParams object from getAttributes () of the Window, and then directly operate on its flag variable. You can also operate the addFlags (int flags) method, setFlags (int flags, int mask) method, and clearFlags (int flags) method of the Window.
For example, set full screen:
Window window = getWindow ();
WindowManager. LayoutParams winParams = win. getAttributes ();
WinParams. flags = winParams. flags | WindowManager. LayoutParams. FLAG_FULLSCREEN;
Or
Window. addFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN );
Or
Window. setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN, WindowManager. LayoutParams. FLAG_FULLSCREEN );
Cancel full screen
Window window = getWindow ();
WinParams. flags = winParams. flags &~ WindowManager. LayoutParams. FLAG_FULLSCREEN;
Or
Window. clearFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN );
Or
Window. setFlags (0, WindowManager. LayoutParams. FLAG_FULLSCREEN );
All windows flags are as follows:
Int FLAGS_CHANGED indicates that flags has changed. For more information, see the following document.
Int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON Window flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on.
The screen lock is allowed when the window is visible to the user.
Int FLAG_ALT_FOCUSABLE_IM Window flag: invert the state of FLAG_NOT_FOCUSABLE with respect to how this window interacts with the current method.
Int FLAG_BLUR_BEHIND Window flag: blur everything behind this window.
Blur everything after the window (blur)
Int FLAG_DIM_BEHIND Window flag: everything behind this window will be dimmed.
Make all the things after the window dim (dim)
Int FLAG_DISMISS_KEYGUARD Window flag: when set the window will cause the keyguard to be dismissed,
Only if it is not a secure lock keyguard.
Int FLAG_DITHER Window flag: turn on dithering when compositing this window to the screen.
Enable dithering)
Int FLAG_FORCE_NOT_FULLSCREEN Window flag: Override {@ link # FLAG_FULLSCREEN and force the screen decorations (such as status bar) to be shown.
Restore non-full screen display of Windows
Int FLAG_FULLSCREEN Window flag: Hide all screen decorations (e.g.
Display windows in full screen
Int FLAG_HARDWARE_ACCELERATED Indicates whether this window shocould be hardware accelerated.

Hardware acceleration for this window.

This flag must be set before setting the Content View of your Activity or Dialog,

And if you enable this attribute with android: hardwareAccelerated in the mainfest file, you cannot change it in the program. In the mainfest file, the android: hardwareAccelerated attribute is enabled by default ("true ").
 
Int FLAG_IGNORE_CHEEK_PRESSES Window flag: intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a participant window, when such an event stream is detected, the application will receive a CANCEL motion event to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released.
 
Int FLAG_KEEP_SCREEN_ON Window flag: as long as this window is visible to the user, keep the device's screen turned on and bright.
When this window is visible to users, the device screen is highlighted.
Int FLAG_LAYOUT_INSET_DECOR Window flag: a special option only for use in combination with FLAG_LAYOUT_IN_SCREEN.
Int FLAG_LAYOUT_IN_SCREEN Window flag: place the window within the entire screen, ignoring decorations around the border (a.k..
Fill the screen of the entire phone with no borders (border)
Int FLAG_LAYOUT_NO_LIMITS Window flag: allow window to extend outside of the screen.
The window size is no longer limited by the phone screen size, that is, the window may be out of the screen, and some content is outside the screen.
Int FLAG_NOT_FOCUSABLE Window flag: this window won't ever get key input focus, so the user can not send key or other button events to it.
So that the window cannot get the focus, so that the user cannot send button events and button events to the window quickly
Int FLAG_NOT_TOUCHABLE Window flag: this window can never receive touch events.
Make the window do not accept touch screen events
Int FLAG_NOT_TOUCH_MODAL Window flag: Even when this window is focusable (its {@ link # FLAG_NOT_FOCUSABLE is not set ),
Allow any pointer events outside of the window to be sent to the windows behind it.
Even if the window obtains focus, any event outside the window is still sent to other windows after the window.
Int FLAG_SCALED Window flag: a special mode where the layout parameters are used to perform scaling of the surface when it is composited to the screen.
Int FLAG_SECURE Window flag: don't allow screen shots while this window is displayed.
Screenshots are not allowed when the window is displayed.
Int FLAG_SHOW_WALLPAPER Window flag: ask that the system wallpaper be shown behind your window.
After this window, the system wallpaper (wallpaper) is displayed)
Int FLAG_SHOW_WHEN_LOCKED Window flag: special flag to let windows be shown when the screen is locked.
This window is displayed when the screen is locked.
Int FLAG_SPLIT_TOUCH Window flag: when set the window will accept for touch events outside of its bounds to be sent to other windows that also support split touch. when this flag is not set, the first pointer that goes down determines the window to which all subsequent touches go until all pointers go up. when this flag is set, each pointer (not necessarily the first) that goes down determines the window to which all subsequent touches of that pointer will go until that pointer goes up thereby enabling touches with multiple pointers to be split into SS multiple windows
When the window can accept the touch screen, the touch screen sent to the following windows outside the window can support split touch.
Int FLAG_TOUCHABLE_WHEN_WAKING Window flag: When set, if the device is asleep when the touch screen is pressed, you will receive this first touch event.
When the mobile phone is sleep, if the screen is pressed, the window will receive the first event
Int FLAG_TURN_SCREEN_ON Window flag: when set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on.
Of course, when the window is displayed, the system will regard it as a user activity event to light up the mobile phone screen.
Int FLAG_WATCH_OUTSIDE_TOUCH Window flag: if you have set FLAG_NOT_TOUCH_MODAL, you can set this flag to receive a single special MotionEvent with the action MotionEvent. ACTION_OUTSIDE
For touches that occur outside of your window.
If you set the flag, even if you FLAG_NOT_TOUNCH_MODAL, even if the touch screen event is sent out of the window, the event is sent to the following window, the window will still use MotionEvent. ACTION_OUTSIDE receives the touch screen event

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.