Android - Set Height to TextView Dynamically
<p>I have some critical issue related to height of TextView. I want to set the height of the TextView based on the content which is set at runtime. Here is my xml code:-</p>

<p><code>&lt;TextView android:id="@+id/tv" 
android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt;</code></p>

<p>Here is the java code to set the height of the TextView:-</p>

<p>`TextView tv = (TextView) findViewById(R.id.tv);</p>

<p>tv.invalidate();</p>

<p>int height_in_pixels = tv.getLineCount() * tv.getLineHeight();</p>

<p>tv.setHeight(height_in_pixels);`</p>

<p>But the <strong>problem</strong> is; <strong>it displays only 1 line, and not the rest of the lines</strong>.</p>
