bug:cannot set keyboardToolbarHeight of a textArea

You must Login before you can answer or comment on any questions.

Here is the code:

var textfield = Titanium.UI.createTextField({
    color:'#336699',
    value:'Focus to see keyboard w/ toolbar',
    height:35,
    width:300,
    top:10,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    keyboardToolbar:[flexSpace,camera, flexSpace,tf,flexSpace, send,flexSpace],
    keyboardToolbarColor: '#999',   
    keyboardToolbarHeight: 80
});
my problem is cannot set keyboardToolbarHeight. And I aslo tried to create a toolbar like this:
var toolbar = Titanium.UI.createToolbar({
        items:[flexSpace,camera, flexSpace,tf,flexSpace, send,flexSpace],
        bottom:0,
        borderTop:true,
        borderBottom:false,
        translucent:true,
        barColor:'gray',
        height:80       
    });
It did't work,neither .Can anyone help me? Thank you so much.....

2 Answers

Hi!What do you mean you can not set the keyboardToolbarHeight? What is your tf, can you post your code for that part?I have to add a textfield to the toolbar!

— answered 7 months ago by Cristina Nardin
answer permalink
1 Comment
  • I mean I set the keyboardToolbarHeight in the code , but its height is not the value I set, it seems always be the some auto height. Hi,this is the part of "tf",I hope it can do some help for you.

    var tf = Titanium.UI.createTextField({
            height:32,
            backgroundImage:'/images/inputfield.png',
            width:200,
            font:{fontSize:15},
            color:'#777',   
            paddingLeft:10,
            borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
        });

    — commented 7 months ago by Arlo Huang

I have no problems with the height, here is my code. But in my case, the toolbar is at the bottom of the window and when I want to write something it doesn't go up with the keyboard that appears..no idea why

var send = Titanium.UI.createButton
({
    //style : Titanium.UI.iPhone.SystemButtonStyle.DONE
    image: 'send_button.png'
}); 
 
var camera = Titanium.UI.createButton
({
    systemButton : Titanium.UI.iPhone.SystemButton.CAMERA,
});
 
var cancel = Titanium.UI.createButton
({
    systemButton : Titanium.UI.iPhone.SystemButton.CANCEL
});
 
var flexSpace = Titanium.UI.createButton
({
    systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
 
var textfield = Titanium.UI.createTextField
({
    borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    hintMessage: 'Text Message',
    width: 220
    // keyboardToolbar : [cancel, flexSpace, camera, flexSpace,send_button],
    // keyboardToolbarColor : '#999',
    // keyboardToolbarHeight : 40,
});
 
var toolbar = Titanium.UI.iOS.createToolbar
({
    items:[camera, flexSpace, textfield, flexSpace , send],
    bottom:0,
    borderTop:true,
    borderBottom:false
})
 
win1.add(toolbar);

— answered 7 months ago by Cristina Nardin
answer permalink
1 Comment
  • I don't have a perfect solution.In this way, I change the value of textfeld2 when the textfield changes. It looks like the textfield can go up with the keyboard. If you have a better solution,please tell me,thx!Here is what I did:

    var send = Titanium.UI.createButton
    ({
        //style : Titanium.UI.iPhone.SystemButtonStyle.DONE
        image: 'send_button.png'
    }); 
     
    var camera = Titanium.UI.createButton
    ({
        systemButton : Titanium.UI.iPhone.SystemButton.CAMERA,
    });
     
    var cancel = Titanium.UI.createButton
    ({
        systemButton : Titanium.UI.iPhone.SystemButton.CANCEL
    });
     
    var flexSpace = Titanium.UI.createButton
    ({
        systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
    });
     
    var textfield = Titanium.UI.createTextField
    ({
        borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
        hintMessage: 'Text Message',
        width: 220
    });
     var textfield2 = Titanium.UI.createTextField
    ({
        borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
        hintMessage: 'Text Message',
        width: 220,
        bottom:0
    });
    var toolbar = Titanium.UI.iOS.createToolbar
    ({
        items:[camera, flexSpace, textfield, flexSpace , send],
        bottom:0,
        borderTop:true,
        borderBottom:false
    })
    textfield.addEventListener('change',function(e){
        textfield2.value = textfield.value;
    }); 
    win1.add(textfield2);

    — commented 7 months ago by Arlo Huang

Your Answer

Think you can help? Login to answer this question!