[android-developers] Re: how to implement scrolling text?
I implemented a scrollable TextView, named ScrollTextView before Android 1.1R1 with the marquee feature for TextView. It used android.widget.Scroller and attached TextPaint. Here's the source code: http://bear-polka.blogspot.com/2009/01/scrolltextview-scrolling-textview-for.html It's glad to see that marquee is supported. However you could not make the TextView scrolling if you only set these 2 attributes, android:ellipsize and android:marqueeRepeatLimit. According to my testing, at least the following 3 attributes shall be set: android:ellipsize=marquee android:focusable=true android:singleLine=true And the TextView shall be focused while running. Moreover, I found 2 limitations in current marquee implementation: 1. Never scroll if the TextView does not get the focuse; 2. The scrolling is odd because the round of scrolling begins from the left side while end at the right side. It looks like the animation is reset. So far, I think my implementation of ScrollTextView is better for the marquee feature. :) On 3月10日, 下午1时55分, soniya soniy...@gmail.com wrote: I am talking about this API Demo: API Demos - Text - Marquee I tried selecting the textbut it does not move...not even a millimeter :( Am I missing something?? On Mar 4, 9:28 pm, Romain Guy romain...@google.com wrote: The marquee starts when a TextView gets focused/selected. It is used throughout the UI in 1.1, for instance in the list of all apps in Home. On Tue, Mar 3, 2009 at 11:00 PM, soniya soniy...@gmail.com wrote: I have downloaded the latest SDK i.e. Android 1.1 but I am not able to run the API demo for Marquee. It does not work The text remain static. Do I need to do any setting or something to view that? On Jan 31, 1:51 am, Romain Guy romain...@google.com wrote: Note that cupcake will have themarqueefeature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
The TextView doesn't have to be focused. You can also use setSelected(true). -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
Set the focus on the buttons to make them scrolling. not selecting the text, but use the UP and Down navigator button of the simulator to change the focus ... On 3月10日, 下午1时55分, soniya soniy...@gmail.com wrote: I am talking about this API Demo: API Demos - Text - Marquee I tried selecting the textbut it does not move...not even a millimeter :( Am I missing something?? On Mar 4, 9:28 pm, Romain Guy romain...@google.com wrote: The marquee starts when a TextView gets focused/selected. It is used throughout the UI in 1.1, for instance in the list of all apps in Home. On Tue, Mar 3, 2009 at 11:00 PM, soniya soniy...@gmail.com wrote: I have downloaded the latest SDK i.e. Android 1.1 but I am not able to run the API demo for Marquee. It does not work The text remain static. Do I need to do any setting or something to view that? On Jan 31, 1:51 am, Romain Guy romain...@google.com wrote: Note that cupcake will have themarqueefeature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
I am talking about this API Demo: API Demos - Text - Marquee I tried selecting the textbut it does not move...not even a millimeter :( Am I missing something?? On Mar 4, 9:28 pm, Romain Guy romain...@google.com wrote: The marquee starts when a TextView gets focused/selected. It is used throughout the UI in 1.1, for instance in the list of all apps in Home. On Tue, Mar 3, 2009 at 11:00 PM, soniya soniy...@gmail.com wrote: I have downloaded the latest SDK i.e. Android 1.1 but I am not able to run the API demo for Marquee. It does not work The text remain static. Do I need to do any setting or something to view that? On Jan 31, 1:51 am, Romain Guy romain...@google.com wrote: Note that cupcake will have themarqueefeature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
I have downloaded the latest SDK i.e. Android 1.1 but I am not able to run the API demo for Marquee. It does not work The text remain static. Do I need to do any setting or something to view that? On Jan 31, 1:51 am, Romain Guy romain...@google.com wrote: Note that cupcake will have themarqueefeature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
The marquee starts when a TextView gets focused/selected. It is used throughout the UI in 1.1, for instance in the list of all apps in Home. On Tue, Mar 3, 2009 at 11:00 PM, soniya soniy...@gmail.com wrote: I have downloaded the latest SDK i.e. Android 1.1 but I am not able to run the API demo for Marquee. It does not work The text remain static. Do I need to do any setting or something to view that? On Jan 31, 1:51 am, Romain Guy romain...@google.com wrote: Note that cupcake will have themarqueefeature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: how to implement scrolling text?
Hi Rodrigo: I asked this same question ages ago and never got an answer. In the end, I concluded the built-in animation machinery cannot handle a case where the bitmap is longer than the view. I wound up not using any of the built-in animation stuff and just blitted raw bitmaps in a custom view. (Except I did have my implementation take Interpolators and work in parametric [0, 1] time, so at least I got free ease-in and ease-out effects.) I'm doing all this in the regular view hierarchy (no surface view or anything) on the main thread. No performance problems to report at speeds up to 20 FPS. -- Ward HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? 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: how to implement scrolling text?
Have you looked at ScrollView? Unfortunately it only supports vertical scrolling right now... On Jan 30, 11:02 am, Ward Willats goo...@wardco.com wrote: Hi Rodrigo: I asked this same question ages ago and never got an answer. In the end, I concluded the built-in animation machinery cannot handle a case where the bitmap is longer than the view. I wound up not using any of the built-in animation stuff and just blitted raw bitmaps in a custom view. (Except I did have my implementation take Interpolators and work in parametric [0, 1] time, so at least I got free ease-in and ease-out effects.) I'm doing all this in the regular view hierarchy (no surface view or anything) on the main thread. No performance problems to report at speeds up to 20 FPS. -- Ward HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? 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: how to implement scrolling text?
Note that cupcake will have the marquee feature on TextView. On Fri, Jan 30, 2009 at 12:31 PM, Zach Hobbs ho...@helloandroid.com wrote: You can create a custom singleLine TextView and animate it by creating a loop and calling scrollBy(x,y) incrementing/decrementing the x value. -Zach On Thursday 29 January 2009 7:47:49 pm Rodrigo wrote: HI, What is the best way to implement scrolling text (with behavior similar to that of HTML tag 'marquee')?? I've been trying to do this using TextViews + Animations but I'm having troubles primarily because of sizing issues. If my text is long enough that it exceeds the screen width, it won't be drawn completely (it's size will be chopped at screen width). Thus, when I animate it from right to left, only a part of the text will be displayed. This happens if I allow a maximum of 1 line in my TextView, because otherwise it makes the TextView have multiple lines. If I make it horizontally scrollable, the same 'chopped-off' behavior is seen. I think this happens because the TextView's parent imposes some restrictions on its size. Is there a way to bypass these restrictions so that the TextView is 'drawn' even if parts of it will be off- screen? If that's not possible, what's an alternative way of implementing this behavior? Thanks! -- Zach Hobbs HelloAndroid.com Android OS news, tutorials, downloads -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---