Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:30:38+00:00 2026-06-15T14:30:38+00:00

Does anyone know if \u200b should be working on Android as a zero width

  • 0

Does anyone know if \u200b should be working on Android as a zero width space that functions as a line break if the TextView length is exceeded by the text of the TextView? It appears that only \u0020 is line breaking for me, but I’m not able to figure out how to have a zero width version of it. \u200b is what I expect should work, per the following link, but it only does the zero-width space and doesn’t break…and as stated, only \u0020 is line breaking.

http://www.cs.tut.fi/~jkorpela/chars/spaces.html

I’ve attached the view of an Activity I’m using for testing where U+ is being used in place of \u.

I’ve also tried using the fromHtml option to see if there is an Html option that works but haven’t had any luck with arial.

Here’s the test code I’m using

public class TextSpaceActivity extends Activity {

public static void start( Context ctx ) {
    ctx.startActivity(  new Intent( ctx, TextSpaceActivity.class )  );
}

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate( savedInstanceState );
    setContentView( R.layout.text_space_activity );
    setTitle( "TextSpaceActivity" );

    setText( R.id.tsa_txvw_1, "abc\u0020123\u0020xyz\u0020987" );
    setText( R.id.tsa_txvw_2, "abc\u200a123\u200axyz\u200a987" );
    setText( R.id.tsa_txvw_3, "abc\u200b123\u200bxyz\u200b987" );
}

TextView txvw;
private void setText( int txvwResId, String txt ) {
    txvw = (TextView)findViewById( txvwResId );
    txvw.setText( txt );
}
}

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:30:40+00:00Added an answer on June 15, 2026 at 2:30 pm

    I don’t believe the line-breaking algorithm understands the zero-width line-break, or soft hyphens, or the line- or paragraph-separator characters for that matter. Here’s the code from the Android source that decides if there can be a line break here (android.text.StaticLayout, lines 358-366 in the source):

    // From the Unicode Line Breaking Algorithm (at least approximately)
    boolean isLineBreak = isSpaceOrTab ||
            // / is class SY and - is class HY, except when followed by a digit
            ((c == CHAR_SLASH || c == CHAR_HYPHEN) &&
            (j + 1 >= spanEnd || !Character.isDigit(chs[j + 1 - paraStart]))) ||
            // Ideographs are class ID: breakpoints when adjacent, except for NS
            // (non-starters), which can be broken after but not before
            (c >= CHAR_FIRST_CJK && isIdeographic(c, true) &&
            j + 1 < spanEnd && isIdeographic(chs[j + 1 - paraStart], false));
    

    where isSpaceOrTab is defined just above (line 343) as:

    boolean isSpaceOrTab = c == CHAR_SPACE || c == CHAR_TAB;
    

    All the CHAR_ constants are plain character constants, so there’s nothing like isspace going on. Lines 952-958 in the same file:

    private static final char CHAR_FIRST_CJK = '\u2E80';
    
    private static final char CHAR_NEW_LINE = '\n';
    private static final char CHAR_TAB = '\t';
    private static final char CHAR_SPACE = ' ';
    private static final char CHAR_SLASH = '/';
    private static final char CHAR_HYPHEN = '-';
    

    Looking at your other comments, I see you’re trying to break Chinese correctly. You might not have to do anything special: as the isIdeographic call above hints, it tries to break between two ideographs without inserting spaces. Only the StaticLayout breaker does this: DynamicLayout only uses newline characters, so it will only break correctly on static text.

    I’m afraid from my research it looks like you’re screwed. My only suggestion for a work-around would be to use a WebView instead of a TextView, and use the superior line-breaking capabilities of the system’s web browser instead of the limited implementation TextView offers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of any websites, or (preferably) downloadable packages that you can use
Does anyone know of a way to contain a nonbreaking space in an html
Does anyone know of any existing solutions using javascript that can parse a crontab
Does anyone know how i can grab a js object key that is in
does anyone know any tool for 'code generation' using MVC2? I know that ASP
Does anyone know of any samples that use the DataTables jquery plugin with a
Does anyone know the facemash algorithm that Mark Zuckerberg implemented in his facemash site?
does anyone know if iOS Simulator (that goes with XCode) support any kind of
Does anyone know of a Visual Studio 2010 C# plugin that will: allow me
Does anyone know if SQL Azure supports merge replication? I am currently working with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.