Textfield getting hidden by keyboard
Hi
My textfield is not sliding up and getting hidden by the keyboard. What could be the reason for this?
Here is my config for the textfield
http://pastie.org/988526
This is happening in both 1.2.0 and 1.3.0
Here is a video of the issue
http://www.youtube.com/watch?v=Z5sOETRou0k
5 Answers
-
You need to attach your textfield to a scrollView, not a window. The scrollView will automatically adjust for the opening/closing of the keyboard.
//Current Window You're Using var win1 = Ti.UI.currentWindow; //Create your scrollView var scrollView1 = Ti.UI.createScrollView({ contentWidth:'auto', contentHeight:'auto', top:0, showVerticalScrollIndicator:true, showHorizontalScrollIndicator:true }); //Create a View var view1 = Ti.UI.createView({ left:0, right:0, height:'auto', top:0 }); //Instantiate scrollView1.add(view1); win1.add(scrollView1); //Define your textfield var yourTextField = createTextField({ ... }); //Add Textfield to scrollView view1.add(yourTextField);
Hopefully that helps.
-
I had the same issue. The solution was to scroll the window up when the textfield is on focus. Here is what I did:
textfield.addEventListener('focus', function() { win.animate({bottom: 166, duration:500}); }); textfield.addEventListener('blur', function() { win.animate({bottom: 0, duration:500}); });
-
And along with this I would also like to know if there is any way of hiding any open keypad in a window. Something which is like blur all.
-
I have the same problem. Did you found any solution? Maybe, Titanium.UI.ScrollView ist the right thing.
ThanksThorsten
-
ScrollView solves that issue however when srolling up the animation is smooth but when scrolling back down the animation not smooth or no animation at all. Any ideas?