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

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

Description

dippx

Declaration

public static int dip2px(Context context, float dipValue) 

Method Source Code

//package com.java2s;

import android.content.Context;

public class Main {
    public static int dip2px(Context context, float dipValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dipValue * scale + 0.5f);
    }//from   w w w  .  j  a v a  2s  .c  o  m
}

Related

  1. converSpToPixel(Context context, float spValue)
  2. convertDpToPixel(Context context, float dpValue)
  3. convertDpToPixel(Context ctx, float dp)
  4. dip2pixel(Context context, int dip)
  5. getPixels(int dp, Context context)
  6. dip2Px(Context context, float dipValue)
  7. dip2px(Context context, float dpValue)
  8. dip2px(Context context, float dpValue)