native.newTextBox on Android

native.newTextBox on Android renders a specific font size so that it’s either too large on phones or too small on tablets. So I need to scale the font with the device…

…but is there a system.getInfo( property ) that can just distinguish between Android phone and tablet form factors, or am I doomed to listing specific Android models? [import]uid: 1560 topic_id: 30271 reply_id: 330271[/import]

Try to set different font sizes for different resolutions like this:

[code]
– here goes some of your logic to calculate font size i.e. 5% of contentHeight or width, give you size 18
– please remember about scalling settings in config.lua

fontSize = 18 – your calculated font value, should be different on different resolutions
local myTextInputBox = native.newTextBox( 10, 30, 180, 30, fieldHandler )
– fieldHendler is your function to handle field events
– set up different font sizes for differetn screens
local myTextInputBox.font = native.newFont( native.systemFontBold, fontSize)
[/code] [import]uid: 145499 topic_id: 30271 reply_id: 121329[/import]

Thanks, I tried contentHeight but that seems not the right value to use because it’s set to the config file’s content scale value. So I get 480 contentHeight for both the Nexus 7 tablet and the Galaxy Nexus.

Update:
display.contentScaleX and …Y should do it. [import]uid: 1560 topic_id: 30271 reply_id: 121426[/import]

Try to set different font sizes for different resolutions like this:

[code]
– here goes some of your logic to calculate font size i.e. 5% of contentHeight or width, give you size 18
– please remember about scalling settings in config.lua

fontSize = 18 – your calculated font value, should be different on different resolutions
local myTextInputBox = native.newTextBox( 10, 30, 180, 30, fieldHandler )
– fieldHendler is your function to handle field events
– set up different font sizes for differetn screens
local myTextInputBox.font = native.newFont( native.systemFontBold, fontSize)
[/code] [import]uid: 145499 topic_id: 30271 reply_id: 121329[/import]

Thanks, I tried contentHeight but that seems not the right value to use because it’s set to the config file’s content scale value. So I get 480 contentHeight for both the Nexus 7 tablet and the Galaxy Nexus.

Update:
display.contentScaleX and …Y should do it. [import]uid: 1560 topic_id: 30271 reply_id: 121426[/import]