[android-developers] Re: Question about using TextView
Tao wrote: Hi all, I just have a question which may be very simple to some of you. How can I make a TextView cut off long strings automatically? I noticed that Activity title can do that: from abcdefgh to abc... Use android:ellipsize http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~-~--~~~---~--~~ 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: Question about using TextView
gotcha, thx :) On Jun 5, 1:27 pm, Mark Murphy mmur...@commonsware.com wrote: Tao wrote: Hi all, I just have a question which may be very simple to some of you. How can I make a TextView cut off long strings automatically? I noticed that Activity title can do that: from abcdefgh to abc... Use android:ellipsize http://developer.android.com/reference/android/widget/TextView.html#a... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ 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: Question about using TextView
Hi Mark, It looks like we need to set a deprecated property on cupcake to make android:ellipsize work properly. android:Single line (Deprecated) = true (--- without this, the ellipsis will not show up) android:ellipsize = end I tried setMaxLines(1) without setting Single line property, it doesn't work Looks weird, maybe a SDK bug? Correct me if I am wrong. On Jun 5, 2:25 pm, Tao grea...@gmail.com wrote: gotcha, thx :) On Jun 5, 1:27 pm, Mark Murphy mmur...@commonsware.com wrote: Tao wrote: Hi all, I just have a question which may be very simple to some of you. How can I make a TextView cut off long strings automatically? I noticed that Activity title can do that: from abcdefgh to abc... Use android:ellipsize http://developer.android.com/reference/android/widget/TextView.html#a... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android Development Wiki:http://wiki.andmob.org --~--~-~--~~~---~--~~ 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: Question about using TextView
Tao wrote: Hi Mark, It looks like we need to set a deprecated property on cupcake to make android:ellipsize work properly. android:Single line (Deprecated) = true (--- without this, the ellipsis will not show up) android:ellipsize = end I tried setMaxLines(1) without setting Single line property, it doesn't work Looks weird, maybe a SDK bug? Correct me if I am wrong. That is strange. android:inputType is now the way to specify you want to support multiline input, so I would have assumed that the default would have been the equivalent of android:singleLine=true. If nobody else chimes in with a solution, you might consider posting a bug over at http://b.android.com. Note that deprecated in Android does not mean unsupported, just not recommended. It may be that this is still a necessary use of android:singleLine, at least for the time being. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Need Android talent? Ask on HADO! http://wiki.andmob.org/hado --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---