get Pixel value from android.util.TypedValue - Android android.graphics

Android examples for android.graphics:Pixel

Description

get Pixel value from android.util.TypedValue

Demo Code

import android.content.Context;
import android.util.TypedValue;

public class Main {

  public static float getPX(Context context, int dipValue) {
    return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, context.getResources().getDisplayMetrics());
  }//www  .j  a  va  2s .  co  m

}

Related Tutorials