Possible to control positioning in Android precisely using XML
<p>I wanted to know if it was possible to precisely position widgets on Android using XML files? From my experiments, precise position seems impossible via XML. Programmatically, I'm able to position things perfectly based on the device width and height. However, using XML and dip values, things seem to fall apart. Here's one <a href="http://stackoverflow.com/questions/10088072/android-positioning-problems">example</a> of what I mean. </p>

<p>Mark Murphy, on an article, wrote:</p>

<blockquote>
  <p>Some developers, perhaps those coming from the "drag-and-drop" school
  of UI development, think first and foremost about the positions of
  widgets. They think that they want certain widgets to be certain fixed
  sizes at certain fixed locations. They get frustrated with Android
  layout manager (containers) and may gravitate to the deprecated
  AbsoluteLayout as a way to design UIs they way they used to.</p>
  
  <p>That rarely works well even on desktops, as can be seen by
  applications that do not handle window resizing very well. Similarly,
  it will not work on mobile devices, particularly Android, with its
  range of screen sizes and resolutions.</p>
  
  <p>Instead of thinking about positions, think about rules. You need to
  teach Android the "business rules" about where widgets should be sized
  and placed, with Android then interpreting those rules based upon what
  the device's screen actually supports in terms of resolution.</p>
</blockquote>

<p><a href="http://www.androidguys.com/2010/02/18/handling-multiple-screen-sizes-part-2/" rel="nofollow">source</a></p>

<p>This leads me to believe that precise positioning is difficult with XML files. This is important for my app because I'm laying out widgets on a background image so that these widgets need to be placed exactly on a particular area so that the overall UI looks good. The aspect ratio needs to be preserved across resolutions. Can I do all this using XML files?</p>

<p>Thanks! Any help is greatly appreciated!</p>
