Android的单选按钮动画 [英] Android Radio Button Animation

查看:582
本文介绍了Android的单选按钮动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好家伙,我想问一下有关自定义的单选按钮的问题。我只是设计了自定义背景和翻转动画的单选按钮。所以,当我点击单选按钮,它翻转和变化的背景,但由于单选按钮属性首先改变背景,然后animate.Please帮助我,我想先制作动画,然后改变的背景。

Hello guys I would like to ask a question related to custom radio button. I just designed the radio button with custom background and flip animation. So that when I click radio button it flip and changes background but due to radio button property it first changes background and then animate.Please help me.I want to animate first and then change background.

感谢您

推荐答案

由code,你可以做这样的事情:

by code, you can do something like this:

Animation anim = AnimationUtils.loadAnimation(this, R.anim./*YOUR ANIMATION*/);

anim.setAnimationListener(new Animation.AnimationListener(){
        @Override
        public void onAnimationStart(Animation arg0) {
        }           
        @Override
        public void onAnimationRepeat(Animation arg0) {
        }           
        @Override
        public void onAnimationEnd(Animation arg0) {
            if(ButtonName.isChecked()){
               ButtonName.setImageResource(R.drawable.ImageChecked);
            }else{
               ButtonName.setImageResource(R.drawable.ImageUnchecked);
            }
        }
    });

    ButtonName.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                ButtonName.startAnimation(anim);
            }
        });

这篇关于Android的单选按钮动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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