Code example for TextPaint

Methods: getTextSize, setTextSize

0
 
        setRawTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
    } 
 
    private void setRawTextSize(float size) {
        if (size != mTextPaint.getTextSize()) {
            mTextPaint.setTextSize(size);
 
            requestLayout();
            invalidate();
        } 
    } 
 
    /** 
     * Sets the text color for all the states (normal, selected, 
     * focused) to be this color. 
     */ 
    public void setTextColor(int color) {
        mTextColor = ColorStateList.valueOf(color);
        updateTextColors(); 
    }