Android:使用FLAG_SECURE时更改窗口背景的颜色 [英] Android: Changing color of window background when using FLAG_SECURE
问题描述
我有一个要求,当将我的Android应用程序置于后台时,我将屏幕空白以隐藏敏感数据.这很容易实现,可以使用:
I have a request that when the my Android application is placed into the background that I blank out the screen to hide sensitive data. This was easy enough to implement using the:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
困难的部分似乎是在更改在后台查看应用程序时获得的空白屏幕的颜色.默认情况下,它看起来是白色的,我似乎无法找到一种方法来替代它.有人有什么想法吗?
The difficult part appears to be changing the color of that blank screen you get when looking at the apps in the background. By default it appears to be white and I can't seem to find a way to override that. Anyone have any ideas?
推荐答案
很遗憾,您无法在最近"视图中自定义缩略图的颜色.
Unfortunately you can't customize the color of the thumbnail in the recents view.
As you can see in TaskViewThumbnail the default color of the thumbnail (0xffffffff
) is hardcoded, so it's not customizable:
/** Updates the paint to draw the thumbnail. */
void updateThumbnailPaintFilter() {
if (mInvisible) {
return;
}
int mul = (int) ((1.0f - mDimAlpha) * mThumbnailAlpha * 255);
int add = (int) ((1.0f - mDimAlpha) * (1 - mThumbnailAlpha) * 255);
if (mBitmapShader != null) {
mLightingColorFilter.setColorMultiply(Color.argb(255, mul, mul, mul));
mLightingColorFilter.setColorAdd(Color.argb(0, add, add, add));
mDrawPaint.setColorFilter(mLightingColorFilter);
mDrawPaint.setColor(0xffffffff);
} else {
int grey = mul + add;
mDrawPaint.setColorFilter(null);
mDrawPaint.setColor(Color.argb(255, grey, grey, grey));
}
invalidate();
}
这篇关于Android:使用FLAG_SECURE时更改窗口背景的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!