I have a very small textarea, only 300x65, but with a very long text. I would like the text to auto scroll up based on timer or event, but I am not able to find any solution. Tried with Scrollview scrollTo and setOffset but not really what I was looking for.
Anyone has a solution for having a text to auto-scroll?
2 Answers
Accepted Answer
hi,
you can try this code...
var lbl = Ti.UI.createLabel({ text : "I have a very small textarea, only 300x65, but with a very long text. I would like the text to auto scroll up based on timer or event, but I am not able to find any solution. Tried with Scrollview scrollTo and setOffset but not really what I was looking for.Anyone has a solution for having a text to auto-scroll?,I have a very small textarea, only 300x65, but with a very long text. I would like the text to auto scroll up based on timer or event, but I am not able to find any solution. Tried with Scrollview scrollTo and setOffset but not really what I was looking for.Anyone has a solution for having a text to auto-scroll?", top : 0, height : 'auto', width : 300 }); var scrollView = Ti.UI.createScrollView({ top : 50, height : 65, width : 300, contentHeight : lbl.toImage().height, contentWidth : 200, backgroundColor : 'red' }); scrollView.add(lbl); win.add(scrollView); var contentHeight = lbl.toImage().height; var c = 0; var timer = setInterval(function(e) { c += 10; if (c <= contentHeight) { scrollView.contentOffset = { x : 0, y : c }; } }, 500);
Thanks! This is what I was looking for.
Your Answer
Think you can help? Login to answer this question!