Code example for Paint

Methods: ascentdescentmeasureText

0
     * @return 
     */ 
    private RectF calcBounds(final int index, final Paint paint) {
        // Calculate the text bounds 
        final RectF bounds = new RectF();
        bounds.right = paint.measureText(this.mTitleProvider.getTitle(index));
        bounds.bottom = paint.descent() - paint.ascent();
        return bounds;
    } 
 
    /** 
     * Calculate views bounds and scroll them according to the current index 
     *  
     * @param paint 
     * @param currentIndex 
     * @return 
     */ 
    private ArrayList<RectF> calculateAllBounds(final Paint paint) {
        final ArrayList<RectF> list = new ArrayList<RectF>();
        // For each views (If no values then add a fake one)