[英]android hide status bar synchronously
I need to put the device programmatically in full screen mode to animate a view, zooming it. 我需要以编程方式将设备置于全屏模式以对视图进行动画处理,然后对其进行缩放。 I have done that, but i would like to start my animation only after my status bar completely be hidden on device.
我已经做到了,但是我只想在状态栏完全隐藏在设备上之后才能开始动画。 How can i do it synchronously?
如何同步进行? WhatsApp do it in android with the profile picture.
WhatsApp使用个人资料图片在android中进行操作。
My code the hidden status bar: 我的代码隐藏状态栏:
//Hide toolbar and set full screen mode
View decorView = context.getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
ActionBar actionBar = ((AppCompatActivity)context).getSupportActionBar();
actionBar.hide();
ActivityCompat.invalidateOptionsMenu(context);
You can wait 2 sec for hide actionBar 您可以等待2秒才能隐藏actionBar
// time delay to hide actionBar
Handler h = new Handler();
h.postDelayed(new
Runnable() {
@Override
public void run () {
startAnimate();
}
}
,2000); // e.g. 2000 milliseconds
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.