apply Dimension via TypedValue - Android android.util

Android examples for android.util:TypedValue

Description

apply Dimension via TypedValue

Demo Code

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

public class Main {

  public static float applyDimension(Context context, int unit, float value) {
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    return TypedValue.applyDimension(unit, value, displayMetrics);
  }/*from w ww.j av a2 s.c  om*/


}

Related Tutorials