Example usage for android.util TypedValue COMPLEX_UNIT_SP

List of usage examples for android.util TypedValue COMPLEX_UNIT_SP

Introduction

In this page you can find the example usage for android.util TypedValue COMPLEX_UNIT_SP.

Prototype

int COMPLEX_UNIT_SP

To view the source code for android.util TypedValue COMPLEX_UNIT_SP.

Click Source Link

Document

#TYPE_DIMENSION complex unit: Value is a scaled pixel.

Usage

From source file:Main.java

public static int spTopx(Context context, float spVal) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spVal,
            context.getResources().getDisplayMetrics());
}

From source file:Main.java

public static int sp2px(Context context, int spValue) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue,
            context.getResources().getDisplayMetrics());
}

From source file:Main.java

public static float sp2px(int sp, DisplayMetrics metrics) {
    return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, metrics);
}

From source file:Main.java

public static float sp2Px(float sp, DisplayMetrics metrics) {
    return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, metrics);
}

From source file:Main.java

public static int typeValueToSp(Context context, int sp) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
            context.getResources().getDisplayMetrics());
}

From source file:Main.java

public static int getSpToPx(Resources res, int dip) {
    int pixel = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, dip, res.getDisplayMetrics());
    return pixel;
}

From source file:Main.java

public static int sp2px(int spValue, DisplayMetrics displayMetrics) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, displayMetrics);
}

From source file:Main.java

static int sp2px(int sp) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
            Resources.getSystem().getDisplayMetrics());
}

From source file:Main.java

static int sp(float sp, DisplayMetrics metrics) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, metrics);
}

From source file:Main.java

public static int spToPx(Context context, int spValue) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue,
            context.getResources().getDisplayMetrics());
}