Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9606] TiAPI: Allow configuration of the default unit (pixels, dpi, etc.)

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2016-08-24T13:51:09.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.0.0
ComponentsTiAPI
Labelscore
ReporterMatt Schmulen
AssigneeEric Merriman
Created2012-06-18T08:31:41.000+0000
Updated2017-03-16T21:39:53.000+0000

Description

Titanium provides universal unit support by allowing the developer to specify unit types when specifying absolute layout parameters ( ie: width, height, left, etc.). if the developer specifies a layout parameter without specifying a unit, the system selects the default unit type ( currently pixels ). The developer must explicitly specify the layout type for unit types that are not the default pixel unit. example: width: "123dp" or width: "123mm" Rarely do application developers create applications that mix units. Therefore devleopers must append to every unit specification the unit type if they do not want to use the default pixels. Causing the following issues: - reduces the efficiency of the developer, - increases the probability of user created bugs in the application code. - increases the size of the executing code, - decreases the performance do to the increased code execution size. Adding a default unit override would resolve these issues allowing the developer to set the number and omit the unit type.

Comments

  1. Chris Barber 2016-08-24

    Titanium has supported a ti.ui.defaultunit property for a long, long time. It's been in the tiapp.xml for all new projects since Titanium SDK 2.0.0.
       <property name="ti.ui.defaultunit">dp</property>
       
  2. Lee Morris 2017-03-16

    Closing ticket as fixed.

JSON Source