android - Programmatically set height on LayoutParams as density-independent pixels -


is there way set height/width of layoutparams density-independent pixels (dp)? looks height/width, when set programmatically, in pixels , not dp.

you need convert dip value pixels:

int height = (int) typedvalue.applydimension(typedvalue.complex_unit_dip, <height>, getresources().getdisplaymetrics()); 

for me trick.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -