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;
import android.util.Log;

public class Main {

    public static int dip2px(Context context, float dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        Log.e("desitiny", scale + "");
        return (int) (dpValue * scale / 1.5 + 0.5f);
    }/*from   w w w .  jav a2  s .  c  om*/
}

Related

  1. dip2px(Context context, int dip)
  2. dipValue(Context context, int dip)
  3. dip2pixel(Context context, float n)
  4. dip2px(Context context, float dipValue)
  5. dip2px(Context context, float dipValue)
  6. dip2px(Context context, float dpValue)
  7. dipToPixel(int dip)
  8. dipsToPixels(Context aContext, int aDip)
  9. convertDIP2PX(Context context, float dip)