Example usage for android.view View getHeight

List of usage examples for android.view View getHeight

Introduction

In this page you can find the example usage for android.view View getHeight.

Prototype

@ViewDebug.ExportedProperty(category = "layout")
public final int getHeight() 

Source Link

Document

Return the height of your view.

Usage

From source file:Main.java

public static int getYRatio(float y, View v) {
    return (int) ((y / v.getHeight()) * 100000);
}

From source file:Main.java

public static float parseRatioToY(int yRatio, View v) {
    return ((float) yRatio) * v.getHeight() / 100000;
}

From source file:Main.java

public static Bitmap getViewBitmap(View v) {
    if (v.getWidth() == 0 || v.getHeight() == 0)
        return null;
    Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(b);
    v.draw(c);//from  w ww  . j  a v  a 2  s . co  m
    return b;
}

From source file:Main.java

public static int bottomInWindow(View view) {
    return topInWindow(view) + view.getHeight();
}

From source file:Main.java

public static float getDistanceToCenter(View target) {
    float viewCenter = target.getTop() + target.getHeight() / 2f;
    float rootCenter = ((View) target.getParent()).getHeight() / 2;
    return target.getHeight() / 2f + rootCenter - viewCenter;
}

From source file:Main.java

public static void counterClockwiseRotation90ByCenter(View v) {
    float w = v.getWidth();
    float h = v.getHeight();
    RotateAnimation anim = new RotateAnimation(0, 90, w / 2, h / 2);
    anim.setDuration(10 * 1);//from   w w w .jav a 2  s .c om
    anim.setFillAfter(true);
    v.startAnimation(anim);
}

From source file:Main.java

private static Bitmap getScreenshot(View v) {
    Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(b);
    v.draw(c);/*from  w ww  .ja  va2 s  . c  o  m*/
    return b;
}

From source file:Main.java

public static Bitmap createBitmap(View v) {
    Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    v.draw(canvas);//w  ww  .  j  a  va 2  s .  c  o  m
    return bitmap;
}

From source file:Main.java

public static Bitmap createViewBitmap(View v) {
    Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    v.draw(canvas);/*from  w  ww. j  av a 2 s. co  m*/
    return bitmap;
}

From source file:Main.java

static public void setPosition(View v, PointF p) {
    int w = v.getWidth();
    int h = v.getHeight();
    v.setLeft((int) p.x);
    v.setTop((int) p.y);
    v.setRight((int) p.x + w);
    v.setBottom((int) p.y + h);
}