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
.
-
-
Save himalay/b0c35232c308c4c9f095 to your computer and use it in GitHub Desktop.
Setting default unit of measurement.
This file contains hidden or 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 hidden or 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment