Java 如何使编辑文本在点击后通过动画变大

Java 如何使编辑文本在点击后通过动画变大,java,android,Java,Android,我想让我的编辑文本更大后,开始写它。 如下图所示。 那我该怎么做?!有人知道吗 您需要检查editText上的焦点并设置AnimatioValue edt.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View arg0, boolean hasfocus) { if (

我想让我的编辑文本更大后,开始写它。 如下图所示。
那我该怎么做?!有人知道吗

您需要检查editText上的焦点并设置AnimatioValue

 edt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View arg0, boolean hasfocus) {
                if (hasfocus) {
                    Log.e("TAG", "edt focused");
                    //ValueAnimator total
                    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1f, 1.5f);
                    valueAnimator.setDuration(325);
                    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                        public void onAnimationUpdate(ValueAnimator animation) {
                            float value = (Float) animation.getAnimatedValue();
                            edt.setScaleX(value);
                            edt.setScaleY(value);
                            edt.requestLayout();
                        }
                    });
                    valueAnimator.start();
                } else {
                    Log.e("TAG", "edt not focused");
                    //animation inverse
                }
            }
 });

梅西·哈姆沙里伊:))帕查姆·伊朗·巴拉斯特