The Problem:
The font of the hintText of a text field changes if the field is a "password field" or if it's a normal field.
Code sample in app.js
var win = Ti.UI.createWindow({
backgroundColor:'black'
});
var username = Ti.UI.createTextField({
top:10,
left:20,right:20,height:40,
backgroundColor:'white',
hintText:'hintText for username'
});
var password = Ti.UI.createTextField({
top:100,
left:20,right:20,height:40,
backgroundColor:'white',
passwordMask:true,
hintText:'hintText for password'
});
win.add(username);
win.add(password);
win.open();
Discussion
As you can see from this example, the only different between the two textFields is the passwordMask. When the application is ran, you'll see that the font is different to the point that one of the texts is longer than the other.
Workaround
Setting the fontFamily on a password field doesn't seem to do anything, but setting it on the normal field does work properly. A workaround for now is to set the font family in the normal field as monospace:
var foo = Ti.UI.createTextField({
top:10,
left:20,right:20,height:40,
backgroundColor:'white',
font:{
fontFamily:'monospace'
},
hintText:'hintText for username'
});
Any updates? This is really ugly. :-(
Still wrong on 3.0.2, Android 4.0. hintText won't use fontFamily if its a password field
This is still happening with: Titanium Studio, build: 3.1.3.201309132423 Build: jenkins-titanium-rcp-master-21 (origin/master) Date: 13 September 2013, 00:23:57 and this Devices: Nexus 7 1st generation Kindle Fire HD 7" Is there any solution or suggestion?
happens with 3.2.0 RCs too. But that's probably because it's an underlying Android thing going on here. This StackOverflow thread has some explanation, and it may be possible to follow at least one of those solutions using Titanium (though I didn't have much luck with trying to set fontFamily: 'sans-serif' after - which also seems to vary the font-size from whatever default is in play.) http://stackoverflow.com/questions/3406534/password-hint-font-in-android
This issue was previously scheduled to be worked on in more than one sprint: * 'Release 3.0.1' (on board 'Customer Issues') * 'Release 3.3.0' (on board '3.2.X Triage') Starting from JIRA Agile 6.3, an issue can only belong to a single future sprint. Read more about this change: http://docs.atlassian.com/agile/docs-0630/Sprint+Marker+Migration This issue is now scheduled for future sprint 'Release 3.3.0' (on board '3.2.X Triage'). If this is incorrect, please update the issue accordingly. This comment was automatically generated by JIRA. If it is no longer relevant, please feel free to delete it.
Please fix it at 3.2.3 version! Same as issue - TIMOB-16100
I will set custom font of text fields. But for password field on Android it not applied. Please fix this issue in 3.2.3 version.
This is an Android bug: https://code.google.com/p/android/issues/detail?id=55418.
master PR: https://github.com/appcelerator/titanium_mobile/pull/5656/files
PR 5656 merged
Verified the FIXED with: Appc-Studio:3.3.0.201405011408 sdk:3.3.0.v20140507163312 acs:1.0.14 alloy:1.4.0-dev npm:1.3.2 titanium:3.3.0-dev titanium-code-processor:1.1.1 xcode:5.1.1 Device:Iphone5s(v7.1.1),Nexus7(v4.4.2) Font is same for both the textField normal as well as passwordMask. Hence Closing the issue as working as expected.