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. Android Market ngambek


ini saya punya android market, kalau di launch, terus close sendiri

kenapa yah



2. Laporan pandangan mata nexian journey

Mantabbbsss.... Kayak reporter TVone... 


send from android tabled made in china

-----Original Message-----
From: "Herry SW" <>
Date: Thu, 16 Dec 2010 05:52:19 
To: Id-android<>; Indocell<>
Subject: [id-android] Laporan pandangan mata nexian journey



3. Need to flash the screen green and red


5. A ready for Android development Eclipse

6. Conversion to Dalvik format failed with error 1

7. Android location