动画师只能在Sherlock Action Bar的Looper线程上运行 [英] Animators may only be run on Looper threads on Sherlock Action Bar

查看:363
本文介绍了动画师只能在Sherlock Action Bar的Looper线程上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在1秒的延迟后隐藏操作栏,

I wanted to hide the action bar after the 1 second delay,

Timer().schedule(new TimerTask() {
                        @Override
                        public void run() {
                                getSupportActionBar().hide();
                        }
                    }, 1000);

运行代码后崩溃.

android.util.AndroidRuntimeException:动画只能在以下位置运行 弯针线

android.util.AndroidRuntimeException: Animators may only be run on Looper threads

这个问题有解决方案吗?谢谢.

Is there any solution for this issue? Thanks.

推荐答案

通过使用

new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                                getSupportActionBar().hide();
                        }
                    }, 1000);

这篇关于动画师只能在Sherlock Action Bar的Looper线程上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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