如何检查半透明导航是否可用?
我目前正在将其设置为半透明的:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
translucentNavigation = true;
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
} 但是,由于我看到某些设备(如N10)禁用了它,当然,如果存在硬键,它也会被禁用,所以我想在设置标志后检查它是否是半透明的,或者在设置之前是否可用。
发布于 2013-11-05 16:06:50
在KitKat设备上,可以使用框架布尔配置资源禁用半透明系统条。您可以在运行时检查该资源的值。
int id = getResources().getIdentifier("config_enableTranslucentDecor", "bool", "android");
if (id == 0) {
// not on KitKat
} else {
boolean enabled = getResources().getBoolean(id);
// enabled = are translucent bars supported on this device
}https://stackoverflow.com/questions/19792977
复制相似问题