Ris*_*shi 0 text titanium appcelerator
您能否发布一个Titanium Appcelerator的示例:从本地应用程序的resources文件夹中读取一个.txt文件,并在Ti.UI.createScrollView上显示该文本文件的内容?
一个非常简单的例子。谢谢。
var win = Titanium.UI.currentWindow;
.
.
.
win.add(scrollView1);
Run Code Online (Sandbox Code Playgroud)
var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'example.txt');
var contents = f.read();
Ti.API.info('Output text of the file: '+contents.text);
Run Code Online (Sandbox Code Playgroud)
这会给你文本。您不能简单地将文本放在滚动视图中,您将需要标签/文本框等。将这些控件之一的值设置为上面的打印输出。
这是指向API的链接,其中包含所有方法和示例代码片段,您将需要研究/学习不能仅仅问您需要的一切。
还建议您下载厨房水槽演示应用程序,因为它具有所有功能的示例