这个在Windows下面可以用, 刚入门学, 感觉用javascript写起来很方便请问用这个软件写程序有没有什么局限?求解

解决方案 »

  1.   


    var platformWidth = Titanium.Platform.displayCaps.platformWidth;
    var platformHeight = Titanium.Platform.displayCaps.platformHeight;
    var platformWidth = Titanium.Platform.displayCaps.platformWidth;
    var platformWidth = Titanium.Platform.displayCaps.platformWidth;var imgView = Titanium.UI.createView({
            backgroundColor: "gray",
            left:   platformWidth  * 0.05,
            top:    platformWidth  * 0.05,
            width:  platformHeight * 0.2,
            height: platformHeight * 0.2,
            borderRadius: 10
    });
    //------------------------------------
    var nameLable = Titanium.UI.createLabel({
            color:'#999',
            text:'Car Park Name:',
            font:{fontSize:16,fontFamily:'Helvetica Neue'},
            textAlign:'left',
            left:  platformWidth * 0.4,
            top:   platformWidth * 0.08,
            width:'auto'
    });
    //------------------------------------
    var dateLable = Titanium.UI.createLabel({
            color:'#999',
            text:'Date:',
            font:{fontSize:16,fontFamily:'Helvetica Neue'},
            textAlign:'left',
            left:  platformWidth * 0.4,
            top:   platformWidth * 0.2,
            width:'auto'
    });
    //------------------------------------
    var levelTxt = Ti.UI.createTextField({
            center: {
                    x:  platformWidth * 0.5,
                    y:  platformWidth * 0.48
            },
            height : 35,
            width : 280,
            hintText : 'Level:',
            //softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
            keyboardType : Ti.UI.KEYBOARD_DEFAULT,
            returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
            borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
    });levelTxt.addEventListener('return', function(e) {
            levelTxt.blur();
            alert('Input was: ' + levelTxt.value);
    });
    //------------------------------------
    var areaTxt = Ti.UI.createTextField({
            center: {
                    x:  platformWidth * 0.5,
                    y:  platformWidth * 0.65
            },
            height : 35,
            width : 280,
            hintText : 'Area:',
            keyboardType : Ti.UI.KEYBOARD_DEFAULT,
            returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
            borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
    });areaTxt.addEventListener('return', function(e) {
            areaTxt.blur();
            alert('Input was: ' + areaTxt.value);
    });
    //------------------------------------
    var saveLable = Titanium.UI.createLabel({
            color:'#999',
            text:'Save current GPS location:',
            font:{fontSize:14,fontFamily:'Helvetica Neue'},
            textAlign:'left',
            left:  platformWidth * 0.08,
            top:   platformWidth * 0.8,
            width:'auto'
    });
    //------------------------------------
    var saveSwitch = Ti.UI.createSwitch({
            value : true,
            top :  platformWidth * 0.8,
            left : platformWidth * 0.7
    });saveSwitch.addEventListener('change', function(e) {
            Ti.API.info('Event value: ' + e.value + ', switch value: ' + saveSwitch.value);
    });
    //------------------------------------// Create a Button.
    var saveButt = Ti.UI.createButton({
            title : 'Save Information',
            height : 38,
            width : 260,
            center: {
                    x:  platformWidth  * 0.5,
                    y:  platformHeight * 0.677
            },
    });// Listen for click events.
    saveButt.addEventListener('click', function() {
            alert('\'saveButt\' was clicked!');
    });// Add to the parent view.
    Titanium.UI.currentWindow.add(saveButt);
    Titanium.UI.currentWindow.add(saveSwitch);
    Titanium.UI.currentWindow.add(saveLable);
    Titanium.UI.currentWindow.add(areaTxt);
    Titanium.UI.currentWindow.add(levelTxt);
    Titanium.UI.currentWindow.add(nameLable);
    Titanium.UI.currentWindow.add(dateLable);
    Titanium.UI.currentWindow.add(imgView);