Android Dip to Pixel Convert scaleDpToPixels(double value, Resources res)

Here you can find the source of scaleDpToPixels(double value, Resources res)

Description

scale Dp To Pixels

License

Open Source License

Declaration

public static int scaleDpToPixels(double value, Resources res) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.content.res.Resources;

public class Main {
    public static int scaleDpToPixels(double value, Resources res) {
        final float scale = res.getDisplayMetrics().density;
        return (int) Math.round(value * scale);
    }/*from  ww  w  . j  a va 2  s .  c o  m*/
}

Related

  1. dip2px(Context context, float dpValue)
  2. dipToPixel(int dip)
  3. dipsToPixels(Context aContext, int aDip)
  4. convertDIP2PX(Context context, float dip)
  5. sp2px(Context context, float spValue)
  6. convertDpToPixel(float dp, Context context)
  7. convertDpToPixel(float dp, Resources resources)
  8. dipToPixels(int dip)
  9. sp2px(Context context, float spValue)