[TIMOB-4755] Android: textField: Property "softKeyboardOnFocus" does not work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-01T11:37:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2012-01, Release 2.0.0, Release 1.8.1 |
Components | Android |
Labels | keyboard, module_textfield, parity, qe-testadded, scrollViews |
Reporter | Florent |
Assignee | Ping Wang |
Created | 2011-06-15T02:31:13.000+0000 |
Updated | 2012-03-03T22:27:52.000+0000 |
Description
When textfield in windows gain focus, the keyboard used to hide them. So i create a big scrollView and put everything inside. It worked perfectly: i was able to see what i wrote. However now, the keyboard launch itself with the windows, so i have to press back button to hide him.
I tried myTextField.blur() but keyboard still happen.
Only way to prevent this is to add focusable: false to my textField, but then i can not acces to the keyboard (even by adding an event to set focusable: true).
Here is my code:
To launch the windows in app.js:
var win = Titanium.UI.createWindow({
backgroundColor: '#D1D1D1',
url: '/authentification.js',
navBarHidden: true,
fullscreen: false
});
win.open();
and authentification.js:
var win = Titanium.UI.currentWindow;
var deviceWidth = Titanium.Platform.displayCaps.platformWidth;
var deviceHeight = Titanium.Platform.displayCaps.platformHeight;
var MainScrollView = Titanium.UI.createScrollView({
contentWidth:deviceWidth,
contentHeight:deviceHeight*79/100,
top:deviceHeight*11/100,
left:0
});
var view = Titanium.UI.createView({
top: deviceHeight * 39 / 100,
left: deviceWidth * 4/100,
width: deviceWidth * 92/100,
height: deviceHeight * 25 / 100,
borderRadius: 5,
borderWidth: 2,
borderColor: '#9B9B9B',
backgroundColor: 'white'
});
var txtFieldPasswd = Titanium.UI.createTextField({
passwordMask:true,
left: deviceWidth*5/100,
width: deviceWidth*82/100,
top: deviceHeight*10/100,
height: deviceHeight* 8/100,
softKeyboardOnFocus:1
});
view.add(txtFieldPasswd);
MainScrollView.add(view);
win.add(MainScrollView);
In order for us to progress this issue, would you please edit the ticket to use the wiki formatting syntax provided. Also, please check your ticket against [the Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AtheJiraTicketChecklist) to ensure you have all the points covered. Many thanks
I update the problem to make it easier to create. I still don't know where it comes from that the kayboard pop up by itself.
Florent Thank you for the changes you have made to the ticket, as now it is almost complete. Would you mind testing the code on 1.7.X as well, though, after installing it from [Continuous Builds](http://wiki.appcelerator.org/display/guides/Continuous+Builds)? Also would you please copy and paste the Titanium SDK builds, including build date and hash, you are using? The full list of what is required for tickets is available in the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist), for future reference. Cheers
Hi Paul, I tested the code on 1.7.X as you asked (1.7.2.v20110712190239 sha1: 2a057a04b19a9a837d2fe221a8858969dde0c347). It works well on emulateur with APIs2.3.3 and 2.3.3 and 2.2 but on device it still doesn't work (Samsung Galaxy S Android sdk 2.2 and Nexus one with 2.3.4) Here is the content of the logfile:
EDIT: I was wrong about the sdk version of my mobile, it's sdk 2.2 and not 2.3.2
When textfield in scrollView, keyboard displays automatically on device (tried 2.3.4 and 3.1). It does not happen on emulator (tried 2.2, 3.1 and 4.0). For device 3.1, keyboard displays automatically as long as there is a textfield (no matter whether it is in a scrollview). But for device 2.3.4, keyboard does not display automatically if textfield is in a View. For device 2.3.4 and 3.1, the property of textField "softKeyboardOnFocus:1" does not work.
Closing bug. Verified fix on: SDK build: 1.9.0.v20120117144634 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201131907 OS: Mac OS X Lion (10.7.1) Device: Droid 3 (2.3.4)