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

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

Description

dippx

Declaration

public static int dip2px(Context context, float dpValue) 

Method Source Code

//package com.java2s;
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 www .  j  av  a  2 s  .c o m
}

Related

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