Jus*_*tin 16 android multi-window
借助Android的多窗口支持,如何检测状态栏是否可见?例如,当处于纵向方向时,如果我是顶级应用程序,状态栏可能是可见的,但是当我是底部应用程序时,状态栏可能不可见.现在,我的观点在底部是有趣的,因为我为不再存在的状态栏腾出了空间.
Fre*_*ott -1
假设您指的是系统 UI 栏,即状态栏,执行以下操作:
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener (new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
// Note that system bars will only be "visible" if none of the
// LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
// TODO: The system bars are visible. Make any desired
// adjustments to your UI, such as showing the action bar or
// other navigational controls.
} else {
// TODO: The system bars are NOT visible. Make any desired
// adjustments to your UI, such as hiding the action bar or
// other navigational controls.
}
}
Run Code Online (Sandbox Code Playgroud)
});
这直接来自文档: https ://developer.android.com/training/system-ui/visibility.html
| 归档时间: |
|
| 查看次数: |
1079 次 |
| 最近记录: |