FileDocCategorySizeDatePackage
MeasureText.javaAPI DocAndroid 1.5 API4027Wed May 06 22:41:08 BST 2009com.example.android.apis.graphics

MeasureText

public class MeasureText extends GraphicsActivity

Fields Summary
private static final int
WIDTH
private static final int
HEIGHT
private static final int
STRIDE
Constructors Summary
Methods Summary
private static int[]createColors()

   // must be >= WIDTH
    
        
        int[] colors = new int[STRIDE * HEIGHT];
        for (int y = 0; y < HEIGHT; y++) {
            for (int x = 0; x < WIDTH; x++) {
                int r = x * 255 / (WIDTH - 1);
                int g = y * 255 / (HEIGHT - 1);
                int b = 255 - Math.min(r, g);
                int a = Math.max(r, g);
                colors[y * STRIDE + x] = (a << 24) | (r << 16) | (g << 8) | b;
            }
        }
        return colors;
    
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);
        setContentView(new SampleView(this));