public class DensityUtils { public static int dpToPx(Context context,int dp){ float density = context.getResources().getDisplayMetrics().density; return (int) (dp*density+0.5f); } public static int pxToDp(Context context,int px){ float density = cont…