Wednesday, May 22, 2013

Re: [android-developers] Re: TextView's line breaking algo leaves whitespace at line beginnings (?)

Bob, it only happens intermittently.  I'm experimenting with text overflowing into another frame once it fills the previous one so I'm using a lot of frame sizes and shapes combined with different font sizes.  During all of this, I've only spotted it two or three times.

Here's my code (my text is a plain String, not styled at the time):

        TextView textView = new TextView (context);
        textView.setText (text);
        textView.setTextSize (fontSize);
        textView.measure (
                    View.MeasureSpec.makeMeasureSpec (widthPx, View.MeasureSpec.AT_MOST),
                    heightPx > 0
                            ? View.MeasureSpec.makeMeasureSpec (heightPx, View.MeasureSpec.AT_MOST)
                            : View.MeasureSpec.makeMeasureSpec (0, View.MeasureSpec.UNSPECIFIED)
        );
        final int w = textView.getMeasuredWidth ();
        final int h = textView.getMeasuredHeight ();
        textView.layout (0, 0, w, h);



On Wed, May 22, 2013 at 6:05 PM, bob <bob@coolfone.comze.com> wrote:
Maybe post a screenshot and/or your layout code?

I tried and I cannot reproduce your issue:



Thanks.


On Wednesday, May 22, 2013 10:50:33 AM UTC-5, latimerius wrote:
Hello,

I just noticed that some lines in my multi-line TextViews (line breaks added by TextView itself) can occasionally turn out slightly indented to the right.  I'm not sure what the cause is but it does look a lot like there was a space at the beginning of the line.

Is this how TextView works, or am I doing something wrong?  It's not a huge problem but it looks a bit ugly so I'd be keen to fix it if possible.

Thank in advance!

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment