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 sp2px(int sp) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
            Resources.getSystem().getDisplayMetrics());
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static int spToPx(Resources res, int dp) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, dp, res.getDisplayMetrics());
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static int sp2px(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, float value) {
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, value,
            context.getResources().getDisplayMetrics());
}

From source file:Main.java

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