如何经过一定的延迟时间隐藏动作条和导航栏? [英] How to hide ActionBar and NavigationBar after a certain delay time?

查看:226
本文介绍了如何经过一定的延迟时间隐藏动作条和导航栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会隐藏导航栏和我的应用程序的操作栏后,一些二是显示不得到感动,并扩大当前视图到全屏。 然后,如果用户触摸屏幕(或更好,如果他向下滑动),使人们看到这两个了。如何?

解决方案

您可以使用处理程序延迟某些操作。

 处理程序H =新的处理程序();

 h.postDelayed(新的Runnable(){

     @覆盖
     公共无效的run(){
         //执行延迟STUFF
         getActionBar()隐藏()。
     }
 }, 延迟时间); // 例如。 3000毫秒
 

  

你把运行内的行动()方法将被后执行   延迟时间设置。

I would hide navigation bar and action bar of my app after some second that display don't get touched, and expand current view to fullscreen. Then if user touch the screen (or better if he swipe down), make visible both again. How to?

解决方案

You can use a Handler to delay certain actions.

 Handler h = new Handler();

 h.postDelayed(new Runnable() {

     @Override
     public void run() {
         // DO DELAYED STUFF
         getActionBar().hide();
     }
 }, delaytime); // e.g. 3000 milliseconds

The actions you take inside the run() method will be executed after the delay-time you set.

这篇关于如何经过一定的延迟时间隐藏动作条和导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆