TextView getPaint - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView getPaint method.

This code example shows how to use the following methods:getWidth, getPaint, getTotalPaddingLeft, getTotalPaddingRight
    // compute the maximum number of digits that fit in the 
    // calculator display without scrolling. 
    private int getNumberFittingDigits(TextView display) {
        int available = display.getWidth()
            - display.getTotalPaddingLeft() - display.getTotalPaddingRight();
        Paint paint = display.getPaint();
        float digitWidth = paint.measureText("2222222222") / 10f;
        return (int) (available / digitWidth);
    protected void setLogic(Logic logic) {
        mLogic = logic;
        NumberKeyListener calculatorKeyListener =
            new NumberKeyListener() {
                public int getInputType() { 
                    // Don't display soft keyboard. 
                    return InputType.TYPE_NULL;
This code example shows how to use the following methods:getPaint, setText, setTextSize

Related TextView getPaint Questions & Answers:

getPaint Method Overview
See Code Examples for other Android TextView Methods: