Android只触发Activity的onPause

来源:互联网 发布:电脑切换网络 编辑:程序博客网 时间:2024/05/20 10:53

It is paused if it has lost focus but is still visible to the user. That is, another activity lies on top of it and that activity either is transparent or doesn't cover the full screen.

要让activity只paused,没有stopped,需要另外一个activity覆盖,上面的activity必须是透明或不能完全覆盖。

dialog不算activity,打开dialog不会触发onPause。

 

要只触发onPause,power off即可,也可打开一个透明的activity。

这样就可以测试activity只在onPause和onResume之间轮转,而且还可以测试activity只在onStop和onStart之间轮转。

原创粉丝点击