Appcelerator简单的文本字段没有显示

时间:2010-11-09 12:12:59

标签: android textfield titanium appcelerator

问候,

我只是想显示一个空白的文本字段(我知道),但它不起作用?

我必须犯一些简单的错误。

这是我的app.js:

Titanium.UI.setBackgroundColor('#FFF');

var win1=Titanium.UI.createWindow({  
    title:'Login',
    backgroundColor:'#FFF'
});

var uname = Titanium.UI.createTextField({
    color:'#336699',
    height:35,
    top:50,
    width:250,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});

win1.add(uname);

我错过了什么吗?上面应该有用,对吧?

我在Ubuntu x86_64上使用Android模拟器

当我使用标签时,uname和标签显示为ok:

Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});

var uname=Titanium.UI.createTextField({
    color:'#336699',
    height:35,
    top:50,
    width:250,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
var label1=Titanium.UI.createLabel({
    color:'#999',
    text:'hello',
    font:{fontSize:20,fontFamily:'Helvetica Neue'},
    textAlign:'center',
    width:'auto'
});

win1.add(uname);
win1.add(label1);

tabGroup.addTab(tab1);
tabGroup.open();

但是如何摆脱标签???

我尝试了几个版本的Android(1.6 API和2.2 API)

非常感谢,

更新:解决方案是: 添加以下行: win1.open({全屏:真});

1 个答案:

答案 0 :(得分:1)

这是你app.js

的结尾
win1.open({fullscreen:true});