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

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

Description

dippx

License

Apache License

Declaration

public static int dip2px(Context context, float dpvalue) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

public class Main {

    public static int dip2px(Context context, float dpvalue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpvalue * scale + 0.5f);
    }// ww w .  ja v  a  2  s .c  om
}

Related

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