千磨万击还坚劲,任尔东西南北风。这篇文章主要讲述android开发全屏切换代码,记录一下相关的知识,希望能为你提供帮助。
private void tryFullScreen(boolean fullScreen) {
if (activity instanceof AppCompatActivity) {
ActionBar supportActionBar = ((AppCompatActivity) activity).getSupportActionBar();
if (supportActionBar != null) {
if (fullScreen) {
supportActionBar.hide();
} else {
supportActionBar.show();
}
}
}
setFullScreen(fullScreen);
}
private void setFullScreen(boolean fullScreen) {
if (activity != null) {
WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
if (fullScreen) {
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
activity.getWindow().setAttributes(attrs);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} else {
attrs.flags &
= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.getWindow().setAttributes(attrs);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
}
【android开发全屏切换代码,记录一下】
推荐阅读
- mapstruct 实体转换及List转换,@Mapper注解转换
- android检测心率应用实例
- IfcRepresentationMap—Mapped shape without transformation
- Instant Apps调研
- APP测试的测试点
- tk.mybatis.mapper.MapperException: 当前实体类不包含名为的属性!,500错误
- nui监听安卓PDA扫描事件
- happen-before 原则理解
- uniapp 在小程序获取当前经纬度,微信账号信息