To make sure your lay-outs look pretty much the same on all devices, including the thousands of different Android resolutions and densities, it's always best to use the 'dp' unit. However, typing '10dp'
instead of 10
is quite a pain. A pain you can easily take away by changing the default unit in your tiapp.xml
.
Created
April 19, 2013 08:59
-
-
Save FokkeZB/5419074 to your computer and use it in GitHub Desktop.
Setting default unit of measurement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var view = Ti.UI.createView({ | |
width: 100, | |
height: '100dp' // Is now exactly the same as the previous line | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<property name="ti.ui.defaultunit" type="string">dp</property> |
Would be great if there was something like this for setting the font family too?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent tip!