android - What unit (px, dip, ?) is expected for the ints in AlertDialog.html#setView(View, int, int, int, int) -


can tell me unit (pixels, dp's, else?) expected left/top/right/bottom spacing ints passed alertdialog.html#setview(view, int, int, int, int)?

the documentation doesn't say, no suprise there...

it's in pixel. think everytime programatically set dimension in android in pixel.

if want pixel independant can use dimension defined in xml:

int valueinpixels = (int) getresources().getdimension(r.dimen.yourdimension) 

or programatically:

resources r = getresources(); float valueinpixels = typedvalue.applydimension(typedvalue.complex_unit_dip, valueindp, r.getdisplaymetrics()); 

Comments