Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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 (<code>android.text.StaticLayout</code>, lines 358-366 in the source):</p> <pre><code>// 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) &amp;&amp; (j + 1 &gt;= 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 &gt;= CHAR_FIRST_CJK &amp;&amp; isIdeographic(c, true) &amp;&amp; j + 1 &lt; spanEnd &amp;&amp; isIdeographic(chs[j + 1 - paraStart], false)); </code></pre> <p>where <code>isSpaceOrTab</code> is defined just above (line 343) as:</p> <pre><code>boolean isSpaceOrTab = c == CHAR_SPACE || c == CHAR_TAB; </code></pre> <p>All the <code>CHAR_</code> constants are plain character constants, so there's nothing like <code>isspace</code> going on. Lines 952-958 in the same file:</p> <pre><code>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 = '-'; </code></pre> <p>Looking at your other comments, I see you're trying to break Chinese correctly. You might not have to do anything special: as the <code>isIdeographic</code> call above hints, it tries to break between two ideographs without inserting spaces. Only the <code>StaticLayout</code> breaker does this: <code>DynamicLayout</code> only uses newline characters, so it will only break correctly on static text.</p> <p>I'm afraid from my research it looks like you're screwed. My only suggestion for a work-around would be to use a <code>WebView</code> instead of a <code>TextView</code>, and use the superior line-breaking capabilities of the system's web browser instead of the limited implementation <code>TextView</code> offers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload