Created
November 30, 2016 16:56
-
-
Save dGorod/27199ba8b00a854b63ceeafb800200a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nl.groenewijkstroom.util; | |
import android.content.res.Resources; | |
import android.util.TypedValue; | |
/** | |
* Created by Dmytro Gorodnytskyi on 13-Apr-16. | |
*/ | |
public class DimensionUtil { | |
public static int pxToDp(float value) { | |
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, | |
Resources.getSystem().getDisplayMetrics())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment