Appcelerator-Titanium 项目无法在 Android 上运行

发布于 2024-12-17 05:41:11 字数 1120 浏览 3 评论 0原文

好的,我正在研究 Appcelerator-Titanium 的使用并复习教程。 根据我了解到的情况,我尝试运行这段代码。 它在 iOS 模拟器上运行完美,但无法在 Android 模拟器或 Android 手机(三星 Galaxy 2s)上运行。 这是我尝试运行的代码。

<!-- language: lang-js -->
    (function(){
        //creating a UI element for the application to run on
        app.UI = {};


        app.UI.createAppWindow = function(_args){
        //create the tab group to return from function
        var tGroup = Ti.UI.createTabGroup();
        //
        //creating the first window for the UI
        //
        var fWindow = Ti.UI.createWindow({
            title:'main window NUMBER 1',
            backgroundColor:'#fff'
        }) ;

        var tab1 = Ti.UI.createTab({
            icon:'KS_nav_ui.png',
            title:'main tab NUMBER 1',
            window:fWindow
        });

        var lbl1 = Ti.UI.createLabel({
            text:'this is my label this is my fun',
            color:'#999',
            font:{fontSize:20},
            textAlign:'center',
            width:'auto'
        });

        tab1.add(lbl1);

        tGroup.add(tab1);
        tGroup.open();
        }
    })();

ok, so I'm studying on the use of Appcelerator-Titanium and am going over the tutorials.
from what i learned i tried to run this code.
it runs perfectly fine on the iOS simulator but it wont run on Android emulator or an Android phone (Samsung Galaxy 2s).
this is the code I've tried to run.

<!-- language: lang-js -->
    (function(){
        //creating a UI element for the application to run on
        app.UI = {};


        app.UI.createAppWindow = function(_args){
        //create the tab group to return from function
        var tGroup = Ti.UI.createTabGroup();
        //
        //creating the first window for the UI
        //
        var fWindow = Ti.UI.createWindow({
            title:'main window NUMBER 1',
            backgroundColor:'#fff'
        }) ;

        var tab1 = Ti.UI.createTab({
            icon:'KS_nav_ui.png',
            title:'main tab NUMBER 1',
            window:fWindow
        });

        var lbl1 = Ti.UI.createLabel({
            text:'this is my label this is my fun',
            color:'#999',
            font:{fontSize:20},
            textAlign:'center',
            width:'auto'
        });

        tab1.add(lbl1);

        tGroup.add(tab1);
        tGroup.open();
        }
    })();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光①夏 2024-12-24 05:41:11

好吧,问题出在这一行:tGroup.add(tab1);
它应该是:tGroup.addTab(tab1);

well, the problem was in the line: tGroup.add(tab1);
it's supposed to be: tGroup.addTab(tab1);

初心 2024-12-24 05:41:11

将标签添加到窗口而不是选项卡。

Add the label to the window instead of the tab.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文