我使用图像作为斜线屏幕的图片。
<style name="AppTheme.Launcher">
<item name="android:windowBackground">@drawable/splash_screen</item>
</style>
Run Code Online (Sandbox Code Playgroud)
然而,在一些不同的设备中,它被拉伸和扭曲。有没有办法像在 ImageView 中那样制作照片中心裁剪?
我知道setFlags做的是用新的标志替换旧标志.并且addFlags会附加更多标志.我只是困惑为什么setFlags方法中的参数我通常看到的相同?例如:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//or
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Run Code Online (Sandbox Code Playgroud)
看了android.view.Window类后,我不清楚为什么他们必须做很多二元运算符(NOT,AND,OR).这样做的目的是什么?
public void setFlags(int flags, int mask) {
final WindowManager.LayoutParams attrs = getAttributes();
attrs.flags = (attrs.flags & ~mask) | (flags & mask);
mForcedWindowFlags |= mask;
dispatchWindowAttributesChanged(attrs);
}
Run Code Online (Sandbox Code Playgroud)
还有一个问题,有什么区别
//argument is a flag
getWindow().addFlags(flag1);
Run Code Online (Sandbox Code Playgroud)
和
//argument is the result of OR operator of 2 identical flags
getWindow().addFlags(flag1 | flag1);
Run Code Online (Sandbox Code Playgroud)
和
//argument is the result of OR operator of 2 different flags
getWindow().addFlags(flag1 | flag 2);
Run Code Online (Sandbox Code Playgroud)
和
//argument is the result of AND operator of 2 …Run Code Online (Sandbox Code Playgroud)