Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26539] Android: Label's default font size should be "dp" unless explicitly set

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2018-11-29T18:36:12.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.0.0
ComponentsAndroid
Labelsandroid, breaking-change, font, label, parity, unit
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-11-09T04:02:33.000+0000
Updated2018-11-30T12:17:09.000+0000

Description

*Summary:* Android's Ti.UI.Label is currently hard-coded to a font size of 15 using the "tiapp.xml" property's "ti.ui.defaultunit". The problem with this is if you set the default unit to pixels (ie: px), then the label will default to "15px" and be too small to read on high DPI devices. The label's default font size should be hard-coded to "dp". We don't have this issue with any of our other UI features such as Button, TextField, Picker, etc. All other UI elements use "dp" by default. Only our Android Label has this problem. iOS does not have this problem. *Steps to reproduce:*

Create a Titanium classic app.

Set up the "tiapp.xml" file's default unit to "px" (pixels) as shown below.

Use the "app.js" below.

Build and run on an Android device that is xxhdpi or higher.

Notice that the text is very tiny. _(This is the bug.)_

tiapp.xml
<ti:app xmlns:ti="http://ti.appcelerator.org">
	<property name="ti.ui.defaultunit" type="string">px</property>
</ti:app>
app.js
var window = Ti.UI.createWindow();
window.add(Ti.UI.createLabel({ text: "Hello World" }));
window.open();
*Android Results:* !Android-dp.png|thumbnail! !Android-px.png|thumbnail! *iOS Results:* !ios-dp.png|thumbnail! !ios-px.png|thumbnail!

Attachments

FileDateSize
Android-dp.png2018-11-09T04:01:04.000+000043232
Android-px.png2018-11-09T04:01:04.000+000040168
ios-dp.png2018-11-09T04:01:04.000+0000101022
ios-px.png2018-11-09T04:01:04.000+0000101117

Comments

  1. Joshua Quick 2018-11-09

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10450
  2. Lokesh Choudhary 2018-11-17

    FR Passed. Waiting for CR to merge.
  3. Lokesh Choudhary 2018-11-29

    PR Merged.
  4. Samir Mohammed 2018-11-30

    *Closing ticket* Fix verified in SDK Version 8.0.0.v20181129161342. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/10450

JSON Source