Android中的Ios密码效果

时间:2015-09-06 20:54:01

标签: java android ios

有没有办法在Android中创建一个按钮按下效果,如Ios密码?

http://i.stack.imgur.com/86jW0.gif

1 个答案:

答案 0 :(得分:0)

public void onCreate(Bundle savedInstanceState) {
    final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(500); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
    animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
    final Button btn = (Button) findViewById(R.id.your_btn);
    btn.startAnimation(animation);
    btn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            view.clearAnimation();
        }
    });
}