解决方案是在根视图上有一个View.OnSystemUiVisibilityChangeListener.
当一个事件发生时你必须等待一段时间才能使它们变暗.定时器是合适的.
private class MySystemUiVisibilityChangeListener implements View.OnSystemUiVisibilityChangeListener {
@Override
public void onSystemUiVisibilityChange(int visibility) {
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
MyActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mRootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
}
});
}
}, 1000);
}
}