title: How to get the height of each line in edit text
body: <p>I want to animate the keyboard when a new line is added or removed just like how telegram does. I am able to add the animation like this:</p>
  <pre class="lang-java prettyprint-override"><code>private void doAnimation(int linesCount, String s){
          Toast.makeText(this, &quot;&quot; + linesCount, Toast.LENGTH_SHORT).show();
          if (linesCount == 1){
              binding.message.getLayoutParams().height = defEditTextHeight;
              return;
          }
          if (linesCount &lt; binding.message.getLineCount()) {
              ValueAnimator anim = ValueAnimator.ofInt(binding.message.getHeight(), binding.message.getHeight() + 60)
                      .setDuration(250);
              anim.addUpdateListener(animation -&gt; {
                  binding.message.getLayoutParams().height = (int) animation.getAnimatedValue();
                  binding.message.requestLayout();
              });
              anim.start();
          }else if( linesCount &gt; binding.message.getLineCount()){
              ValueAnimator anim = ValueAnimator.ofInt(binding.message.getHeight(), binding.message.getHeight() - 60)
                      .setDuration(250);
              anim.addUpdateListener(animation -&gt; {
                  binding.message.getLayoutParams().height = (int) animation.getAnimatedValue();
                  binding.message.requestLayout();
              });
              anim.start();
          }
      }
  </code></pre>
  <p>But, as you can see for the animation I am adding a random value like 60. But, this is not reliable for all the devices.</p>
  <p>So, how can I get the height of each line so that I can add it and get a good animation?</p>
  <p>Thanks in advance </p>