Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Simple textfield: Blank screen

Greetings,

I'm trying to simply display a blank textfield (I know), but it's not working?

I must be making some simple error.

Here is my 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);

Am I missing something? The above should work, right?

I'm using Android emulator on Ubuntu x86_64

When I use tabs the uname and label appear 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();

But how do I get rid of the tabs???

Many thanks in advance,

— asked November 9th 2010 by Eamonn Hynes
  • android
  • simple
  • textfield
0 Comments

1 Answer

  • is this on the end of you app.js

    win1.open({fullscreen:true});
    
    — answered November 9th 2010 by Aaron Saunders
    permalink
    2 Comments
    • I think this was his issue, but note that setting the fullscreen property is not required for it to work.

      — commented November 10th 2010 by Paul Dowsett
    • Further to the fullscreen property, it's not good to use it unless absolutely necessary, as it hides the android status bar. Try using the navBarHidden: true property instead.

      — commented November 10th 2010 by Paul Dowsett
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.