动画 yoyo 在键入 Edittext 时保持 运行

Animation yoyo keep run when typing Edittext

输入编辑文本时yoyo动画保持运行如何保持输入显示动画一次?

text_send.addTextChangedListener(new TextWatcher() {
                @Override
                public void afterTextChanged(Editable s) {}
    
                @Override
                public void beforeTextChanged(CharSequence s, int start,
                                              int count, int after) {
    
                 
                }
    
                @Override
                public void onTextChanged(CharSequence s, int start,
                                          int before, int count) {
    
                    if(s.length() != 0) {
    
    
                        YoYo.with(Techniques.SlideInUp)
                                .duration(300)
                                .repeat(0)
                                .
                                        playOn(btn_send);
    
    
    
    
                        btn_send.setImageResource(R.drawable.ic_send);

输入编辑文本时yoyo动画保持运行如何保持输入显示动画一次?

如果您只想在用户开始输入时显示一次,请使用 bool 来实现

boolean is_show = false;
text_send.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {}

            @Override
            public void beforeTextChanged(CharSequence s, int start,
                                          int count, int after) {

             
            }

            @Override
            public void onTextChanged(CharSequence s, int start,
                                      int before, int count) {

                if(s.length() != 0) {


                    if(!is_show){
                        is_show = true;
                        YoYo.with(Techniques.SlideInUp)
                            .duration(300)
                            .repeat(0)
                            .
                                    playOn(btn_send);
                      }




                    btn_send.setImageResource(R.drawable.ic_send);

或者您在问其他问题?