My main activity has a RelativeLayout that includes some TextViews.
The vertical position is determined by things like this in the XML:

   <TextView android:id="@+id/name"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_alignParentTop="true"
        android:textSize="18sp" android:textColor="#000000" ></
TextView>
    <TextView android:id="@+id/frequency"
        android:layout_below="@id/name"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_alignParentLeft="true"
        android:textSize="18sp" android:textColor="#000000"></
TextView>

As you can see, the vertical positioning of id/frequency is to be
directly below id/name.  At various times the app sets different
strings as the text of these TextViews.  Sometimes the top TextView is
supposed to be blank.  I do that by setting:

  nameTV.setText(nameString);  //..where nameString happens to be
"" (zero length)

And I expect that after such a setting, the RelativeLayout will
continue to hold a 18sp vertical space for the blanked TextView, so
that the second TextView appears in its proper place regardless.  And
indeed this is exactly what happens on the emulator and on a Motorola
Droid and on two different Chinese-brand tablets.  The app is compiled
use API 8 for Android 2.2.  But on a Acer A100 tablet running Android
3.2, this is not what happens.  Instead a TextView with a zero-length
text takes up no room at all and the second TextView slides up to
where the first TextView would have been.  I know I could probably fix
the problem by setText(" ") instead of setText(""), but there are
various reasons in my app that would make that a messy solution.  Can
anyone confirm or explain this layout behavior?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to