Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bubbleguuum opened this issue May 29, 2014 · 11 comments
Closed
Milestone

Comments

@bubbleguuum
Copy link

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

@RomanZhilich
Copy link

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

@bubbleguuum
Copy link
Author

android:includeFontPadding doesn't help unfortunately.
singleLine works properly but the equivalent maxLines=1 combined with ellipsize="end" doesn't...

The TextView code is super complex and it is not obvious why it doesn't work..

@chrisjenx
Copy link
Owner

Again this is odd, I used android:ellipsize and it works for me (singleLine admittedly). I'll add it to 1.1 backlog to investigate after 1.0 goes out the door.

@chrisjenx chrisjenx added this to the 1.1.0 milestone May 30, 2014
@bubbleguuum
Copy link
Author

singleLine works with ellipsizing. But doesn't with maxLines.

But after more research, it is not a Calligraphy bug but with ellipsizing not working with Spannable text:

http://stackoverflow.com/questions/14691511/textview-using-spannable-ellipsize-doesnt-work

@chrisjenx
Copy link
Owner

@bubbleguuum ahh ok, That will effect 1.0 as we moved to using Spannables to set the Typeface.
Thanks for the heads up.

@bubbleguuum
Copy link
Author

I wonder if using a Spannable to set the Typeface may have other undesired side effects.
The TextView code is full of Spannable specific code.

@chrisjenx
Copy link
Owner

Agreed but it let's us set typeface where text view does stupid things.
On 30 May 2014 11:32, "bubbleguuum" notifications@github.com wrote:

I wonder if using a Spannable to set the Typeface may have other undesired
side effects.


Reply to this email directly or view it on GitHub
#43 (comment)
.

@chrisjenx
Copy link
Owner

@bubbleguuum this should be been cleared up, we only use Spannable in rare cases now (mainly ActionBar(Sub)Title.

Closing.

@PankajChunchun
Copy link

Spannable in rare cases? No. Now a days, we use in many cases and this issue still exists...

@dinakarmaurya-innova
Copy link

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"

@AnwarShahriar
Copy link

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"

Thanks @dinakarmaurya-innova this actually worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants