Home > Back-end >  What unit should I use to set imageView width and height in Android?
What unit should I use to set imageView width and height in Android?

Time:02-21

 imageView.getLayoutParams().height = 130;
 imageView.getLayoutParams().width= 230;

Here 130 and 230 are DP or pixel?

CodePudding user response:

They're in pixels. All lengths and widths outside of xml are in pixels. You can convert DP to pixels by using Converting pixels to dp if you want to specify the size in dp.

  • Related