问题
I have an Android game created with help of libGDX. I want to disable the ability to take screenshots.
For regular android activities you can use getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
method. It works fine.
But it doesn't work with activities extended from com.badlogic.gdx.backends.android.AndroidApplication
. I'm still able to take screenshots.
Any ideas?
回答1:
Calling initialize
in AndroidApplication sets up the window parameters for a full-screen game, so it's overwriting your window parameters. So instead, put this in onCreate
after you call initialize
. Note that you should use addFlags
instead of setFlags
so you don't mess up the other flags that Libgdx set.
getWindow().addFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
来源:https://stackoverflow.com/questions/33941381/flag-secure-not-working-on-libgdxs-androidapplication