我只是想知道是否有一种简单的方法来查看在Android上运行的应用程序当前是否全屏显示.有没有办法查询android,看看你目前是在全屏模式或类似的东西?
VeV*_*VeV 13
刚刚完成Sigwann的回答:
boolean fullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
boolean forceNotFullScreen = (getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) != 0;
boolean actionbarVisible = getActionBar().isShowing();
Run Code Online (Sandbox Code Playgroud)
小智 11
我想Commonsware想说getWindow().getAttributes()而不是getWindow().getFlags(); 因为据我所知,getFlags不存在.至少它不是在doc.
你需要读取getWindow().getAttributes().flags,这是一个int.
WindowManager.LayoutParams lp = getWindow().getAttributes(); int i = lp.flags;
根据android文档,FLAG_FULLSCREEN = 1024.所以你的旗帜是lp.flags的第11口
如果此咬合= 1,则激活全屏.
按照Sigwann的信息,这里是我的代码....
public boolean isFullScreen() {
int flg = getWindow().getAttributes().flags;
boolean flag = false;
if ((flg & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
flag = true;
}
return flag;
}
Run Code Online (Sandbox Code Playgroud)
简单,但有效!
| 归档时间: |
|
| 查看次数: |
6514 次 |
| 最近记录: |