I am building a tabbed mobile application in Appcellerator Titanium.
I need to fill one tab with a big text-segment, and are using a TextArea to do this:
var explanationView = Ti.UI.createTextArea({
enabled: false,
editable: false,
color: 'black',
value: explanation
});
This displays the text as I want. However when the content gets too long to fit it shows the latter part of the content, forcing the user to scroll upwards to find the beginning of the text.
What I get: What I want:
__________ ______________
| CONTENT | || ||
_|__________|_ || VIEW ||
|| || ||__________||
|| VIEW || | Content |
||__________|| |__________|
I guess my question is twofold:
- Is there a way to force the TextArea to scroll to the top when generated?
- Is there a better way using titanium to accomplish an uneditable textView?
- Update with solution -
Martin is absolutely right, the best way to make a non-editable text for display is to use Ti.UI.Label
. A working solution in my case were to replace the above code with the following:
var explanationView = Titanium.UI.createScrollView()
explanationView.add(Ti.UI.createLabel({text: explanation, color:'black'}))
win.add(explanationView)