Android的,如何使用动画以示闪烁? [英] Android, How to use animation in order to show blinking?

查看:187
本文介绍了Android的,如何使用动画以示闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的申请,我已经录制按钮。我想,当用户在其上点击每一秒我改变背景,以模拟闪烁。我创建了一个处理程序,并将其设置为1秒这个处理程序运行,因此每一秒。在这里,我改变的背景。这是我的code:

In my application, I have recording button. I want when user clicks on it each one second i change the background in order to simulate blinking. I created a handler and set it to 1 second therefore each one second this handler runs. Here i change the background. this my code:

mUpdateUITimerTask = new Runnable() {
            public void run() {

                // Simulating blinking for capture button
                if(bolToggle) {
                    bolToggle = false;
                    captureButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_record_blink));
                } else {
                    bolToggle = true;
                    captureButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_record));
                }

                mHandler.postDelayed(mUpdateUITimerTask, 1000);
            }
        };

当我运行应用程序,我看到的变化,但其并不清楚。按钮是这样的:

When I run the app i see the changes but its not clear. buttons are like this:

当我运行应用程序时,红色的图像显示正常,但对于白色图像,它显示了它周围的白色小晕红色图像。
我试图把 captureButton.setBackgroundColor(Color.TRANSPARENT); 之前设置的背景,但结果是一样的。

When i run the application, red image is showing ok but for white image, it shows red image with a little white halo around it. I tried to put captureButton.setBackgroundColor(Color.TRANSPARENT); before setting background but result was same.

任何建议将AP preciated。谢谢你。

any suggestion would be appreciated. Thank you.

推荐答案

找到你需要的答案: http://stackoverflow.com / A /一百三十五万二千五百五十六分之四百八十五万二千四百六十八

基本上你想要一个奥飞动漫。我相信,这将使得整个按键闪但是,你只是想红点闪烁?

Basically you want an alpha animation. I believe this will make the entire button flash however, do you only want the red dot flashing?

这篇关于Android的,如何使用动画以示闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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