title: is it possible to predict new location of UI elements in different screens in Android?
body: <p>I have been trying to find out how android relocates UI elements on different screens for the same application. I've been doing some tests with Android 2.2's music player:
  <a href="https://i.stack.imgur.com/iOEz0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iOEz0.png" alt="Android 2.2 music player"></a><br>
  <sub>(source: <a href="http://www.simplehelp.net/images/android_music_windows/android_music_windows17.png" rel="nofollow noreferrer">simplehelp.net</a>)</sub>  </p>
  
  <p>Here is the position(top left corner) for the first image button of the MediaPlaybackActivity in different screen sizes:
  Screen 1 (resolution: 480x800, density: 240dpi): coordinates in px: 345, 109
  Screen 2 (resolution: 240x400, density: 120dpi): coordinates in px: 173, 53
  Screen 3 (resolution: 320x480, density: 160dpi): coordinates in px: 230, 46</p>
  
  <p>My question is: given the coordinates of a UI element (the button in this case) in any screen, is it possible to predict the coordinates of that element on the other two screens?
  I've tried converting from px to dp and then back to px but it doesn't work (though is close), here is what I've tried:</p>
  
  <p>location of image button with index 0 in screen 2 in px: 173, 53
  location of image button with index 0 in screen 2 in dp: 230.66, 70.66 () (I use this formula: px = dp * (dpi / 160) which I found <a href="https://developer.android.com/guide/practices/screens_support.html" rel="nofollow noreferrer">here</a>)
  location of image button with index 0 in screen 1 in px: 346, 106</p>
  
  <p>You can see that here is quite close but when using this same formula to convert px from screen 1 to screen 3 I get: 230, 72.66, so you can see that the difference in the <em>y</em> axis is quite big. I suppose the upper bar affects the <em>y</em> axis but I don't understand why such a difference.</p>
  
  <p>I'm I doing something wrong here? is there a way to predict the new location and size of UI elements?, how does Android relocates the views?</p>
  
  <p>Thanks in advance.</p>