Android Dip to Pixel Convert sp2px(Context context, float spValue)

Here you can find the source of sp2px(Context context, float spValue)

Description

sppx

Declaration

public static int sp2px(Context context, float spValue) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.res.Resources;

public class Main {

    public static int sp2px(Context context, float spValue) {
        Resources resources = context.getResources();
        final float fontScale = resources.getDisplayMetrics().scaledDensity;
        resources = null;/*  w ww .  j  a  v  a 2s  .  c o m*/
        return (int) (spValue * fontScale + 0.5f);
    }
}

Related

  1. sp2px(Context context, float spValue)
  2. scaleDpToPixels(double value, Resources res)
  3. convertDpToPixel(float dp, Context context)
  4. convertDpToPixel(float dp, Resources resources)
  5. dipToPixels(int dip)
  6. sp2px(float sp, Context context)
  7. convertDiptoPix(int dip, Context context)