Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7260] Android: TextField hintText's font is different in passwordMask field than normal field

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-07T22:43:09.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 09, 2014 Sprint 09 SDK, Release 3.3.0
ComponentsAndroid
Labelsmodule_textfield, qe-closed-3.3.0, qe-testadded, supportTeam
ReporterPedro Enrique
AssigneeHieu Pham
Created2012-01-17T13:18:53.000+0000
Updated2014-05-19T22:28:07.000+0000

Description

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'
});

Comments

  1. Rafael Kellermann Streit 2013-02-24

    Any updates? This is really ugly. :-(
  2. Michael Gangolf 2013-03-01

    Still wrong on 3.0.2, Android 4.0. hintText won't use fontFamily if its a password field
  3. Sergio Infante Montero 2013-12-11

    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?
  4. James R Grinter 2013-12-23

    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
  5. Unknown 2014-04-22

    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.
  6. Alexey Chulochnikov 2014-04-23

    Please fix it at 3.2.3 version! Same as issue - TIMOB-16100
  7. Viktor Korol 2014-04-23

    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.
  8. Hieu Pham 2014-05-01

    This is an Android bug: https://code.google.com/p/android/issues/detail?id=55418.
  9. Hieu Pham 2014-05-01

    master PR: https://github.com/appcelerator/titanium_mobile/pull/5656/files
  10. Vishal Duggal 2014-05-07

    PR 5656 merged
  11. Priya Agarwal 2014-05-08

    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.

JSON Source