【问题标题】:Animated loading icon in ActionBarActionBar 中的动画加载图标
【发布时间】:2020-09-28 22:43:09
【问题描述】:

我正在开发一个应用,其帐户系统与 Firebase 相关联。

好吧,注册过程需要几秒钟,我希望在操作栏中实现一个像这样的旋转加载图标:

唯一的问题是我不知道如何让菜单项旋转以及如何禁用它的 onClick 功能。

【问题讨论】:

    标签: android android-actionbar menu-items


    【解决方案1】:

    使用Runnable 将可绘制对象中的图像设置为Thread.sleep(10);

     new Thread(new Runnable() {
            @Override
            public void run() {
                stuff();
                finish();
            }
        }).start();
    

    public void stuff(){
        for (int i=0;i<50;i+=5){ //put i< the number of images you have
            try {                //for your animation.
                Thread.sleep(10);
                //set your image here.
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    

    【讨论】:

    • 你能说得更清楚些吗?
    猜你喜欢
    • 1970-01-01
    • 2021-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-10
    • 2014-09-09
    • 1970-01-01
    相关资源
    最近更新 更多