LoginSignup
0

More than 5 years have passed since last update.

TItaniumで、TextFiledに文字を入力し、背景色を変える。

Last updated at Posted at 2012-12-28
var win1 = Ti.UI.createWindow({
    backgroundColor:'#ff8080'
});

var textFiled = Ti.UI.createTextField({
    keyboardType: Titanium.UI.KEYBOARD_DEFAULT,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    autocapitalization:false,
    width:'200dp',
    top:'25%'
});
win1.add(textFiled);

textFiled.addEventListener('blur',function(e){
    if(textFiled.value === '赤色') win1.setBackgroundColor('#ff0000');
    else if(textFiled.value === '黄色') win1.setBackgroundColor('#ffff00');
    else if(textFiled.value === '青色') win1.setBackgroundColor('#0000ff');
    else win1.setBackgroundColor('#fff');
});

win1.open();

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0