Example usage for android.util TypedValue complexToDimensionPixelSize

List of usage examples for android.util TypedValue complexToDimensionPixelSize

Introduction

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

Prototype

public static int complexToDimensionPixelSize(int data, DisplayMetrics metrics) 

Source Link

Document

Converts a complex data value holding a dimension to its final value as an integer pixel size.

Usage

From source file:Main.java

public static int GetActionBarHeight(Context c) {
    TypedValue tv = new TypedValue();
    if (c.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        int height = TypedValue.complexToDimensionPixelSize(tv.data, c.getResources().getDisplayMetrics());
        return height;
    }// w w  w  . j a va 2 s  .c o m
    return 0;
}

From source file:Main.java

public static int getActionBarHeight(Activity activity) {
    TypedValue tv = new TypedValue();
    if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        return TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
    }/*from w  ww  . j  a  v a 2  s  .  co  m*/
    return 0;
}

From source file:Main.java

public static int getActionBarHeight(Context context) {
    TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        return TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
    }// w ww  .j a  v a2s . co m
    return 0;
}

From source file:Main.java

public static int getActionBarSize(Activity activity) {

    TypedValue tv = new TypedValue();
    if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        return TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
    }//from  ww  w  . j  a v a 2 s  .c  o m

    return 0;

}

From source file:Main.java

static int getActionBarHeight(Context context) {
    TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        int actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
                context.getResources().getDisplayMetrics());

        return actionBarHeight;
    }/*from   w  w w.  j  a  va2 s  .  com*/

    return 0;
}

From source file:Main.java

public static int getSystemUiActionBarHeight(Activity activity) {
    final TypedValue typedValue = new TypedValue();
    if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) {
        return TypedValue.complexToDimensionPixelSize(typedValue.data,
                activity.getResources().getDisplayMetrics());
    }/*from  www  . j a  va2s . com*/
    return -1;
}

From source file:Main.java

static int getActionbarSize(Context context) {
    int actionbarSize = -1;
    TypedValue typedValue = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) {
        actionbarSize = TypedValue.complexToDimensionPixelSize(typedValue.data,
                context.getResources().getDisplayMetrics());
    }// w w w  .  java2  s. c om
    return actionbarSize;
}

From source file:Main.java

/**
 * Get ActionBar size./*  www.  j a  v a 2  s  . c om*/
 */
public static int getActionBarSize(Context context) {
    int actionBarSize = 0;
    TypedValue tv = new TypedValue();
    if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        actionBarSize = TypedValue.complexToDimensionPixelSize(tv.data,
                context.getResources().getDisplayMetrics());
    }
    return actionBarSize;
}

From source file:Main.java

/**
 * @Description:/* www .ja  v a2  s .c  o m*/
 * @param applicationContext
 * @return
 */
public static int getHeightActionBar(Context context) {
    int height;
    TypedValue typeValue = new TypedValue();
    context.getTheme().resolveAttribute(android.R.attr.actionBarSize, typeValue, true);
    height = TypedValue.complexToDimensionPixelSize(typeValue.data, context.getResources().getDisplayMetrics());
    return height;
}

From source file:Main.java

public static int getActionBarHeight(Context context) {
    if (sActionBarHeight != 0) {
        return sActionBarHeight;
    }//from   w  w  w . j av a  2 s .  co  m

    context.getTheme().resolveAttribute(android.R.attr.actionBarSize, sTypedValue, true);
    sActionBarHeight = TypedValue.complexToDimensionPixelSize(sTypedValue.data,
            context.getResources().getDisplayMetrics());
    return sActionBarHeight;
}