android:maxLines and android:ellipsis results in ellipsis not displayed
See original GitHub issueA 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:
- Created 9 years ago
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try playing with
android:includeFontPadding
As far as I rememberandroid:ellipsize
is a huge pain. It only works reliable withandroid:singleLine
.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”