How to define dimension in Android using XML

You can create common dimensions to use for various screen elements by defining dimension values in XML.

Here is some examples to define dimension using XML.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="one_pixels">1px</dimen>
<dimen name="five_dp">5dp</dimen>
<dimen name="1_inch">1in</dimen>
<dimen name="1_cm">10mm</dimen>
</resources>