Q:

Android: proper way to size UI elements for different size screens - dp vs?

Basic question here - if I define a widget in the following manner:
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@android:color/blue"/>

and I look at the widget on two different devices - one of them with a large screen and one of them with a small screen - which of the following will happen?
a) The widget will appear the same "size" on both screens - i.e. if it takes up one inch of real space on the big screen, it will take up one inch of real space on the small one, even if it that means that it doesn't all fit in the visible screen area.
b) The widget will appear as one inch on the big screen, but as some fraction of an inch on the small screen. However the result will be relative - if the widget took up three quarters of the width of the large screen, it will take up exactly three quarters of the width of the small screen.
Now, assuming that your answer was a - how do I redefine the widget to make it b? Assuming your answer was b, how do I redefine the widget to make it a? Many thanks.

A:

DP is "density independent pixel" which is by definiton equals 1px on a screen with a dpi (dot per inch) of 160. Every device has a different dpi, the cheaper ones usually have less, the more expensive ones more etc.
You can calculate "real" size based on the device's specification but to answer your question, 50dp will look different on different screens, and their "real size" will be also different. 
You can read more about this in the Android docs:
http://developer.android.com/guide/practices/screens_support.html

