0

In my main layout file, I have stated the following:

android:padding="10dp"

In my code, I said:

int padding = getPaddingLeft();

If I debug the code in Eclipse, padding would equal a value of 20 in integer.

Does that mean that to express dp in integer format, we need to multiple it by 2?

Simon
  • 19,658
  • 27
  • 149
  • 217

1 Answers1

0

No that methods returns pixel value

public int getPaddingLeft ()

Added in API level 1
Returns the left padding of this view. If there are inset and enabled scrollbars, this value may include the space required to display the scrollbars as well.

Returns
the left padding in pixels

Source

Which means that the device you are currently using is an xhdpi device

Benoit
  • 4,549
  • 3
  • 28
  • 45