Android动态设置禁止截屏
private void setWindowSecure(boolean isSecure
) {
if (isSecure
) {
if ((getWindow().getAttributes().flags
& WindowManager
.LayoutParams
.FLAG_SECURE
) != 0) {
return;
}
getWindow().addFlags(WindowManager
.LayoutParams
.FLAG_SECURE
);
} else {
if ((getWindow().getAttributes().flags
& WindowManager
.LayoutParams
.FLAG_SECURE
) == 0) {
return;
}
getWindow().clearFlags(WindowManager
.LayoutParams
.FLAG_SECURE
);
}
}
转自 https://my.oschina.net/kingguary/blog/1610267
转载请注明原文地址: https://lol.8miu.com/read-20371.html