Tag Archives: programmatically

17Oct/15

Set margins in dp programmatically – Android

Sometimes at runtime, it is required to set margin to a view. But, the problem is getting different size for different screen sizes, i.e. hdpi, xhdpi, xxhdpi, etc.

This could be done easily with the help of screen specific value resources.

Provide screen specific dimension

values/dimen.xml

Continue reading