Android Dip to Pixel Convert dip2px(Context context, float dpValue)

Here you can find the source of dip2px(Context context, float dpValue)

Description

dip to px

Declaration

public static int dip2px(Context context, float dpValue) 

Method Source Code

//package com.java2s;
import android.content.Context;

public class Main {
    /**// w  ww. java2 s  .c  o  m
     * dip to px
     */
    public static int dip2px(Context context, float dpValue) {

        final float scale = context.getResources().getDisplayMetrics().density;

        return (int) (dpValue * scale + 0.5f);

    }
}

Related

  1. dip2pixel(Context context, int dip)
  2. dip2px(Context context, float dipValue)
  3. getPixels(int dp, Context context)
  4. dip2Px(Context context, float dipValue)
  5. dip2px(Context context, float dpValue)
  6. dip2px(Context context, float dpvalue)
  7. dip2px(float dipValue, float scale)
  8. dipToPixels(Context context, float dipValue)
  9. dp2px(Context context, float dp)