I want to set the layoutMarginBottom of a view in dp i.e layoutParams.bottomMargin = 90dp; instead of pixels.I have tried the dp to pixel conversion formula but they don’t work same in every case,means the value differs with the density of the screen of the device.Please tell me how to do that?Thanks in advance.
I want to set the layoutMarginBottom of a view in dp i.e layoutParams.bottomMargin =
Share
You can set like this, here i am arranging layout margins dynamically..
first store those values in the
dimensions.xmlfile invalues folder