My app has a tableview with multiple rows, one of them containing a textfield. If there are only a few rows in the tableview, I can click on the textfield, it gets focus, the keyboard pops up and everything is fine. But when there are to much rows (so that the keyboard hides at least one row), something weird is happening: I click on the textfield, it gets focus, the keyboard pops up and then the textfield instantly looses focus. No chance to enter text!
I've setup a simple demo. Just create a new project and replace the original content of app.js with the following code:
var win1 = Titanium.UI.createWindow({ backgroundColor: '#000000', layout: 'vertical', exitOnClose: true }); var button = Ti.UI.createButton({ title: 'click' }); win1.add(button); button.addEventListener('click', function(e) { // append one more tableviewrow tableview.appendRow(Ti.UI.createTableViewRow({ title: 'C'})); }); var tableview = Ti.UI.createTableView({ backgroundColor: '#404040' }); var data = []; var tableviewrow = Ti.UI.createTableViewRow({}); var textfield = Ti.UI.createTextField({ width: '100%', value: '' }); tableviewrow.add(textfield); data.push(tableviewrow); data.push(Ti.UI.createTableViewRow({ title: 'A'})); data.push(Ti.UI.createTableViewRow({ title: 'B'})); tableview.data = data; win1.add(tableview); win1.open();This happens only on android. The iOS version works fine. In android settings/language&keyboard I have disabled Japanese IME and Chinese (?). Only Android keyboard is active. With the other keyboards the effect will appear in a different manner.
I recommend to use HVGA screen, cause the effect happens, when you click the button once. With WVGA854 you have to click more often in order to get more rows. Remember that at least one row must be hidden by the keyboard.
Application type: mobile. Titanium SDK: 1.8.2. Platform & version: Android 2.3.3 V8 & Rhino. Device: Android emulator. Host Operating System: OSX and Windows XP. Titanium Studio: 1.0.9.201202141208.
There is one interesting log in the console:
W/IInputConnectionWrapper( 531): finishComposingText on inactive InputConnection