title: Best practice for defining width & height for Android UI elements
body: <p>I read in some posts that it's better to define ui elements in xml and not programmatically, and also that I should use dp units inside xml, so I wonder now how can I determine which <strong>fixed</strong> values should I use ?</p>
  
  <p>Let's say I want to have an ImageView with a width that is 1/3 of the screen's width. Is there an <strong>offline</strong> way to find the dp number I should specify inside the xml or should I still set the height &amp; width programmatically ?</p>