title: Adjust EditText to font size
body: <p>I'm wondering how to adjust height of edit text to te font size. I mean editText is always same hight no matter if i change fontSize to 5sp or leave default. Of course i could use something like this:</p>
  
  <pre><code>&lt;EditText
           android:id="@+id/msgInput"
           android:layout_width="wrap_content"
           android:layout_height="20dp"
           android:inputType="textMultiLine"
           android:textSize="14sp"
           android:hint="@string/hintMsgInput"&gt;
  &lt;/EditText&gt;
  </code></pre>
  
  <p>but i also want to stretch if there are more than 1 line. How can i do it?</p>
  
  <p>[EDIT]:</p>
  
  <p>Ok,i solved it in this way:</p>
  
  <pre><code>msgInput = (EditText) findViewById(R.id.msgInput);
          msgInput.addTextChangedListener(new TextWatcher()
          {
  
              public void afterTextChanged(Editable s) {
                  if (msgInput.getLineCount() &gt; 1)
                  {
                      msgInput.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
                  }
                  else
                  {
                      int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, getResources().getDisplayMetrics());
                      msgInput.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, height));
                  }
              }
  
              public void beforeTextChanged(CharSequence s, int start, int count,
                      int after) {         
              }
  
              public void onTextChanged(CharSequence s, int start, int before,
                      int count) {         
              }
  
          });
  </code></pre>