[android-developers] Re: Showing ellipsis in a TextView?
nEx, I finally took a look at the TextUtils class. It doesn't seem to consider height at all, just width - you found the same thing right? I think I have to measure each character at a time and handle wrapping myself until it gets to a maxLines parameter I'll set, then do the ellipsizing, Thanks On Oct 21, 11:40 am, Mark Wyszomierski mar...@gmail.com wrote: Ha that's the same exact control I'm looking to create, multiline and if it spills over three vertical lines, replace the last few characters with anellipsisand More text - the user clicks that and the textview expands to full height. I have written this kind of control for blackberry but was hoping there'd be something already premade in android. I'll check out the source of TextView as a starting point. Thanks for your help and confirming this. On Oct 21, 12:31 pm, nEx.Software email.nex.softw...@gmail.com wrote: I have ellipsize working for multiline text. I had to write my own ellipsize function to do it. I wanted to replace the ... with ...Read More so my implementation is highly customized. A tip, you can clone the ellipsize function from the AOSP then use it directly. The problem appears to be not in the ellipsize code itself but in somewhere in how the TextView tells its size to the ellipsize function. I have not tracked down exactly where this is happening and since I don't have a build environment setup for AOSP, it would be hard for me to test it anyway. I should revisit my implementation and see if I can clean it up for more generic use. On Oct 21, 8:30 am, Mark Wyszomierski mar...@gmail.com wrote: Ok, that confirms what I'm seeing. I wonder if there really is a way to get theellipsisto work for multiline text. If not, I will have to write a widget for it unfortunately! Thanks On Oct 20, 12:37 pm, Wouter wouterg...@gmail.com wrote: Yes I have searched this also before and this also works for single line text so i think you have to use it this way.. Wouter On Oct 20, 6:23 pm, MarkWyszomierskimar...@gmail.com wrote: Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like theellipsisdoes not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, MarkWyszomierskimar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show anellipsisat the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the setellipsiscalls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Showing ellipsis in a TextView?
Ok, that confirms what I'm seeing. I wonder if there really is a way to get the ellipsis to work for multiline text. If not, I will have to write a widget for it unfortunately! Thanks On Oct 20, 12:37 pm, Wouter wouterg...@gmail.com wrote: Yes I have searched this also before and this also works for single line text so i think you have to use it this way.. Wouter On Oct 20, 6:23 pm, MarkWyszomierskimar...@gmail.com wrote: Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like the ellipsis does not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, MarkWyszomierskimar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Showing ellipsis in a TextView?
I have ellipsize working for multiline text. I had to write my own ellipsize function to do it. I wanted to replace the ... with ...Read More so my implementation is highly customized. A tip, you can clone the ellipsize function from the AOSP then use it directly. The problem appears to be not in the ellipsize code itself but in somewhere in how the TextView tells its size to the ellipsize function. I have not tracked down exactly where this is happening and since I don't have a build environment setup for AOSP, it would be hard for me to test it anyway. I should revisit my implementation and see if I can clean it up for more generic use. On Oct 21, 8:30 am, Mark Wyszomierski mar...@gmail.com wrote: Ok, that confirms what I'm seeing. I wonder if there really is a way to get the ellipsis to work for multiline text. If not, I will have to write a widget for it unfortunately! Thanks On Oct 20, 12:37 pm, Wouter wouterg...@gmail.com wrote: Yes I have searched this also before and this also works for single line text so i think you have to use it this way.. Wouter On Oct 20, 6:23 pm, MarkWyszomierskimar...@gmail.com wrote: Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like the ellipsis does not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, MarkWyszomierskimar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Showing ellipsis in a TextView?
Ha that's the same exact control I'm looking to create, multiline and if it spills over three vertical lines, replace the last few characters with an ellipsis and More text - the user clicks that and the textview expands to full height. I have written this kind of control for blackberry but was hoping there'd be something already premade in android. I'll check out the source of TextView as a starting point. Thanks for your help and confirming this. On Oct 21, 12:31 pm, nEx.Software email.nex.softw...@gmail.com wrote: I have ellipsize working for multiline text. I had to write my own ellipsize function to do it. I wanted to replace the ... with ...Read More so my implementation is highly customized. A tip, you can clone the ellipsize function from the AOSP then use it directly. The problem appears to be not in the ellipsize code itself but in somewhere in how the TextView tells its size to the ellipsize function. I have not tracked down exactly where this is happening and since I don't have a build environment setup for AOSP, it would be hard for me to test it anyway. I should revisit my implementation and see if I can clean it up for more generic use. On Oct 21, 8:30 am, Mark Wyszomierski mar...@gmail.com wrote: Ok, that confirms what I'm seeing. I wonder if there really is a way to get the ellipsis to work for multiline text. If not, I will have to write a widget for it unfortunately! Thanks On Oct 20, 12:37 pm, Wouter wouterg...@gmail.com wrote: Yes I have searched this also before and this also works for single line text so i think you have to use it this way.. Wouter On Oct 20, 6:23 pm, MarkWyszomierskimar...@gmail.com wrote: Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like the ellipsis does not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, MarkWyszomierskimar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Showing ellipsis in a TextView?
I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, Mark Wyszomierski mar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Showing ellipsis in a TextView?
Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like the ellipsis does not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, Mark Wyszomierski mar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Showing ellipsis in a TextView?
Yes I have searched this also before and this also works for single line text so i think you have to use it this way.. Wouter On Oct 20, 6:23 pm, Mark Wyszomierski mar...@gmail.com wrote: Hi Wouter, Yes that does work for single line text, but not for multiline - checking from other posts here it seems like the ellipsis does not handle multiline text correctly? Thanks On Oct 20, 12:06 pm, Wouter wouterg...@gmail.com wrote: I use this in my layout xml file: android:ellipsize=end android:singleLine=true And this works perfectly for text on 1 line.. On Oct 20, 5:42 pm, Mark Wyszomierski mar...@gmail.com wrote: Hi, I have a normal TextView which has multiple lines. I set its max number of lines to 3. I'd like it to show an ellipsis at the end if the text is too long: TextView tv = new TextView(context); tv.setLines(tv); tv.setText(some really long text...); I tried the set ellipsis calls but it doesn't seem to do anything - the text appears the same way. How do we get this to work? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---