Thank you very much for your clear explaination. Now I agree with you that we had better use dip/sp as the dimention unit to design the UI. However when we shall use px/mm/pt?
On 3月1日, 下午12时16分, Romain Guy <[email protected]> wrote: > Hi, > > The reason for dip to exist is simple enough. Take for instance the > T-Mobile G1. It has a pixel resolution of 320x480 pixels. Now image > another device, with the same physical screen size, but more pixels, > for instance 640x480. This device would have a higher pixel density > than the G1. > > If you specify, in your application, a button with a width of 100 > pixels, it will look at lot smaller on the 640x480 device than on the > 320x480 device. Now, if you specify the width of the button to be 100 > dip, the button will appear to have exactly the same size on the two > devices. > > You can easily see this happen when you compare the T-Mobile G1 with > the Android emulator. Computer monitors usually have low/medium pixel > densities. For instance, the monitor I'm using to write this email has > a density of about 100 pixels per inch, whereas the G1 has about 180 > pixels per inch. This means that when I compare my application on the > G1 with my application on the Android emulator on my computer, the > version on my computer appears a lot bigger to me. > > It is very important that you use resolution independent units like > dip when you create your UI. This well help make your application run > on future Android devices that may or may not have the same pixel > density as the G1. > > > > On Sat, Feb 28, 2009 at 8:06 PM, Xiongzh <[email protected]> wrote: > > > I'm being confused by the 'screen density' concept in Android. > > I knwe that dpi (dot per inch) came from the printing device. 160 dpi > > means 160 dots in every inch on the paper. > > However, when dpi is used for the screen density, for example, what's > > mentioned '160 dpi screen' in Android document, what's the meaning? > > 160 pixels on every inch of the display? > > > As described > > inhttp://code.google.com/intl/zh-CN/android/reference/available-resourc..., > > 1 dip (density-independent pixel) means 1 pixel on a 160 dpi screen. > > Why does the ratio of dp-to-pixel not necessarily change with the > > screen density in direct proportion? > > > When the dpi is changed from 160 to 80, how many pixels will 1dp will > > take? 0.5? > > > I can hardly understand why dip/dp is introduced into Android. > > > Thank you in advance for explaining that to me. > > -- > Romain Guy > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

