Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Layout for zero-length strings in TextView
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
RLScott  
View profile  
 More options Nov 4 2011, 11:32 am
From: RLScott <fixthatpi...@yahoo.com>
Date: Fri, 4 Nov 2011 08:32:46 -0700 (PDT)
Local: Fri, Nov 4 2011 11:32 am
Subject: Layout for zero-length strings in TextView
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Belvedere Computer Services  
View profile  
 More options Nov 4 2011, 5:26 pm
From: Belvedere Computer Services <fa829...@gmail.com>
Date: Fri, 4 Nov 2011 14:26:29 -0700 (PDT)
Local: Fri, Nov 4 2011 5:26 pm
Subject: Re: Layout for zero-length strings in TextView
not to argue ~ I feel we need to establish a Compatibility Definition
for the issue - just recently I had jet another GUI designer try to
tell me nulls were handled by the code when we were looking at code
that had no null handler = in other works (my opinion) is default
behavior for supplied GUI should

1] trap nulls on a String and put a "" in place silently
2] display a supplied "" in the intuitive manner of null
3] allow " " to be specified as a workaround that == ""

this is a pestilence from days begone and needs to go there

On Nov 4, 10:32 am, RLScott <fixthatpi...@yahoo.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RLScott  
View profile  
 More options Nov 4 2011, 9:03 pm
From: RLScott <fixthatpi...@yahoo.com>
Date: Fri, 4 Nov 2011 18:03:19 -0700 (PDT)
Local: Fri, Nov 4 2011 9:03 pm
Subject: Re: Layout for zero-length strings in TextView
On Nov 4, 4:26 pm, Belvedere Computer Services <fa829...@gmail.com>
wrote:

> not to argue ~ I feel we need to establish a Compatibility Definition
> for the issue - just recently I had jet another GUI designer try to
> tell me nulls were handled by the code when we were looking at code
> that had no null handler = in other works (my opinion) is default
> behavior for supplied GUI should

> 1] trap nulls on a String and put a "" in place silently
> 2] display a supplied "" in the intuitive manner of null
> 3] allow " " to be specified as a workaround that == ""

> this is a pestilence from days begone and needs to go there

That is a different problem.  I was never using nulls.  All my strings
were real strings that sometimes had zero length (no characters).
There is a big difference between a String variable that is null and a
String variable that refers to a string with zero characters in it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug  
View profile  
 More options Nov 5 2011, 10:15 pm
From: Doug <beafd...@gmail.com>
Date: Sat, 5 Nov 2011 19:15:32 -0700 (PDT)
Local: Sat, Nov 5 2011 10:15 pm
Subject: Re: Layout for zero-length strings in TextView
I remember noting this as a difference in Honeycomb compared to old
Android versions.  You might want to try in a Honeycomb (and even ICS)
emulator as a reference.  And I would love for a Google Android
engineer to chime in as to why the behavior or TextView changed --
this is not an insignificant change.

Doug

On Nov 4, 8:32 am, RLScott <fixthatpi...@yahoo.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lokesh gupta  
View profile  
 More options Nov 6 2011, 2:09 am
From: lokesh gupta <lokeshgupt...@gmail.com>
Date: Sun, 6 Nov 2011 12:39:08 +0530
Local: Sun, Nov 6 2011 2:09 am
Subject: Re: [android-developers] Re: Layout for zero-length strings in TextView

Please give android:textSize="                   "

This will solve your problem.

Lokesh

--
Thanks & Regards
Lokesh Gupta

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »