I have a TextView that is still taking up space when there is no text to display. This happens only on OS 1.6. When my app runs on 2.2, the height of the TextView collapses so that it doesn't take up any space. Is there some property I can set in TextView to cause it to collapse or disappear when no text is set? Here is my xml code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:layout_marginTop="3dp"
android:layout_marginRight="3dp"
android:background="#ff737373"
android:padding="3dp"
android:minWidth="64dp" >
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:tag="tabImage"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:tag="tabCaption"
android:textColor="#ffd9d9d9" />
</LinearLayout>
If you want to make a textview disappear if its text is null
then use android:visibility
or programatically use textview.setVisibility(View.INVISIBLE);
or textview.setVisibility(View.GONE);
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With