question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

android:maxLines and android:ellipsis results in ellipsis not displayed

See original GitHub issue

A TextView defining both maxLine (whatever the value) and ellipsize results in the TextView applying the custom font but not displaying the ellipsis (…) for strings longer than maxLines.

      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        fontPath="@string/media_item_title_font"      
        android:maxLines="2"
        android:ellipsize="end"
        tools:ignore="MissingPrefix" />

With the following text:

this is line1 this is line2 this is line3

the TextView above will display:

this is line1 this is line2

instead of:

this is line1 this is line2…

Removing the fontPath element produces the expected result

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
RomanZhilichcommented, May 30, 2014

Try playing with android:includeFontPadding As far as I remember android:ellipsize is a huge pain. It only works reliable with android:singleLine.

4reactions
dinakarmaurya-innovacommented, Aug 22, 2019

Setting below attribute works(show … at the end) only if the TextView width is match parent android:ellipsize=“end” android:maxLines=“1” android:singleLine=“true”

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I tell if my textview has been ellipsized? - Stack Overflow
You can get the layout of the TextView and check the ellipsis ... lineCount > MAX_LINES_COLLAPSED) { // text is not fully displayed...
Read more >
Ellipsize functionality in TextView does not put ... - Issue Tracker
If the text in the TextView contains spaces ellipsis aren't shown. It works fine if it is just a single long word. Verified...
Read more >
How To Fix Text-Overflow Ellipsis Not Working - Semicolon.dev
First 5 items are required to make ellipsis work in any HTML element: overflow: hidden;; white-space: nowrap;; text-overflow: ellipsis;; display: ...
Read more >
text-overflow | CSS-Tricks
The text-overflow property in CSS deals with situations where text is clipped when it overflows the element's box.
Read more >
CSS text-overflow property - W3Schools
The text-overflow property specifies how overflowed content that is not displayed should be signaled to the user. It can be clipped, display an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found