Default display unit px or dp?

by Markus » Tue, 13 Oct 2009 05:17:00 GMT

Sponsored Links
 I always thought the default display unit would be pixels.

But when I run my application on WVGA800 in the emulator the lines are
five pixels wide even though I called Paint.setStrokeWidth(3). The
same seems to happen with Drawable.setBounds(); the value I provide
gets multiplied by 1.5 internally.

If that's the case, how can I specify pixels instead of dips if I want

Can someone clarify this?


Default display unit px or dp?

by Romain Guy » Tue, 13 Oct 2009 05:20:09 GMT

 The Java APIs work only with pixels. Your app is probably running in
compatibility mode.

Romain Guy
Android framework engineer

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


Sponsored Links

Default display unit px or dp?

by Markus » Tue, 13 Oct 2009 06:08:20 GMT

 Specifying android:minSdkVersion="4" in the android manifest did the



Other Threads

1. Unable to start activity

Hello everyone!

I think I have a common problem with Android Beginners. When I try to
run my program, it's mentioned on the emulator: Unable to start
activity ComponentInfo{ricm2.msg /ricm2.msg.gps}:

I believe my code is correct, it has no problem! but when I come to
run my GPS, nothing is working :(:(:(
This project is important for one course I have this semester!

Thanks for your help!

2. gtalkservice.IGTalkSession.logout() causes GTalk Service to crash

Has anybody else experienced causing the
GTalkService to crash?

3. "Hello, Android!" doesn't get built.

4. About Terms & conditions to submit an application

5. Android's DALVIK failing to build

6. anyone know how to integrate the Wimax drvier, GSM driver, CDMA2000 modem driver

7. need to learn java