Example usage for android.graphics Canvas drawText

List of usage examples for android.graphics Canvas drawText

Introduction

In this page you can find the example usage for android.graphics Canvas drawText.

Prototype

public void drawText(@NonNull String text, float x, float y, @NonNull Paint paint) 

Source Link

Document

Draw the text, with origin at (x,y), using the specified paint.

Usage

From source file:io.doist.datetimepicker.date.SimpleMonthView.java

/**
 * Draws the month days./*from w  w  w. j  ava  2s.  c  o m*/
 */
private void drawDays(Canvas canvas) {
    int y = (((mRowHeight + mMiniDayNumberTextSize) / 2) - DAY_SEPARATOR_WIDTH) + mMonthHeaderSize;
    int dayWidthHalf = (mWidth - mPadding * 2) / (mNumDays * 2);
    int j = findDayOffset();
    for (int day = 1; day <= mNumCells; day++) {
        int x = (2 * j + 1) * dayWidthHalf + mPadding;
        if (mSelectedDay == day) {
            canvas.drawCircle(x, y - (mMiniDayNumberTextSize / 3), mDaySelectedCircleSize,
                    mDayNumberSelectedPaint);
        }

        if (mHasToday && mToday == day) {
            mDayNumberPaint.setColor(mSelectedDayColor);
        } else {
            mDayNumberPaint.setColor(mNormalTextColor);
        }
        final Paint paint = (day < mEnabledDayStart || day > mEnabledDayEnd) ? mDayNumberDisabledPaint
                : mDayNumberPaint;
        canvas.drawText(String.format("%d", day), x, y, paint);
        j++;
        if (j == mNumDays) {
            j = 0;
            y += mRowHeight;
        }
    }
}

From source file:ch.ethz.dcg.jukefox.manager.libraryimport.AndroidAlbumCoverFetcherThread.java

private void drawTextOnBitmap(CompleteAlbum album, Bitmap bitmapHigh, int bitmapSize, float textHeight) {
    Canvas canvas = new Canvas(bitmapHigh);
    canvas.drawARGB(0, 125, 125, 125);//  ww  w  . ja va 2  s .c  o m
    Paint paint = new Paint();
    paint.setColor(Color.BLACK);
    paint.setTypeface(Typeface.SERIF);
    paint.setSubpixelText(true);
    paint.setTextSize(textHeight);
    paint.setAntiAlias(true);
    String artist = album.getArtists().get(0).getName();
    String shortenedText = new String(artist);

    int textLength = artist.length();
    if (textLength > 18) {
        shortenedText = artist.substring(0, 15) + "...";
        textLength = 18;
    } else if (textLength < 8) {
        while (shortenedText.length() < 8) {
            shortenedText = " " + shortenedText + " ";
        }
    }
    float pixelLength = paint.measureText(shortenedText);
    paint.setTextSize(textHeight * (bitmapSize * 2 / 3) / pixelLength);

    canvas.drawText(shortenedText, bitmapSize / 6, bitmapSize / 3, paint);

    shortenedText = album.getName();
    textLength = album.getName().length();
    if (textLength > 18) {
        shortenedText = album.getName().substring(0, 15) + "...";
        textLength = 18;
    } else if (textLength < 8) {
        while (shortenedText.length() < 8) {
            shortenedText = " " + shortenedText + " ";
        }
    }
    paint.setTextSize(bitmapSize / 10f);
    pixelLength = paint.measureText(shortenedText);
    textHeight = textHeight * bitmapSize * 2f / 3f / pixelLength;
    paint.setTextSize(textHeight);

    canvas.drawText(shortenedText, bitmapSize / 6f, bitmapSize * 2 / 3f + textHeight, paint);
}

From source file:com.pax.view.keyboard.CustomKeyboardView.java

@Override
public void onDraw(Canvas canvas) {
    List<Keyboard.Key> keys = getKeyboard().getKeys();
    for (Keyboard.Key key : keys) {
        canvas.save();//from ww w .  j  av a 2s.c  om

        int offsetY = 0;
        if (key.y == 0) {
            offsetY = 1;
        }
        int initDrawY = key.y + offsetY;
        Rect rect = new Rect(key.x, initDrawY, key.x + key.width, key.y + key.height);
        canvas.clipRect(rect);

        Drawable drawable = null;
        if (null != key.codes && key.codes.length != 0) {
            int primaryCode = key.codes[0];

            if (primaryCode < 0) {
                drawable = mOpKeyBgDrawable;
            } else {
                drawable = mKeyBgDrawable;
            }
        }

        if (null != drawable && null == key.icon) {
            int[] state = key.getCurrentDrawableState();
            drawable.setState(state);
            drawable.setBounds(rect);
            drawable.draw(canvas);
        }

        paint.setAntiAlias(true);
        paint.setTextAlign(Paint.Align.CENTER);
        paint.setTextSize(50);
        paint.setColor(Color.BLACK);

        if (key.icon != null) {
            int[] state = key.getCurrentDrawableState();
            key.icon.setState(state);
            key.icon.setBounds(rect);
            key.icon.draw(canvas);
        }

        if (key.label != null) {
            canvas.drawText(key.label.toString(), key.x + (key.width / 2),
                    initDrawY + (key.height + paint.getTextSize() - paint.descent()) / 2, paint);
        }
        canvas.restore();
    }
}

From source file:com.cssweb.android.view.KlineMini.java

public void drawQuoteWin(Canvas canvas, JSONObject quoteData, int idx) throws JSONException {
    Paint mPaint = new Paint();
    mPaint.setTextAlign(Paint.Align.LEFT);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setTypeface(Typeface.DEFAULT_BOLD);
    mPaint.setAntiAlias(true);//from  w  ww  .j  a v  a  2  s .  c  o  m

    mPaint.setColor(GlobalColor.colorKlinePopub);
    mPaint.setTextSize(sTextSize);
    canvas.drawText(":", 0, axisLabelHeight, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 3, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 5, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 7, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 9, mPaint);
    canvas.drawText(":", 0, axisLabelHeight * 11, mPaint);

    mPaint.setTextAlign(Paint.Align.RIGHT);
    String qt = quoteData.getJSONArray("K").getJSONArray(idx).getString(0);
    double jrkp = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(1);
    double zg = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(2);
    double zd = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(3);
    double sp = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(4);
    double preclose;
    if ("cf".equals(exchange) || "dc".equals(exchange) || "sf".equals(exchange) || "cz".equals(exchange)) {
        switch (idx) {
        case 0:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(7);
            break;
        default:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx - 1).getDouble(7);
            break;
        }
        if (quoteData.getJSONArray("K").length() == 1) {
            preclose = quoteData.getJSONArray("K").getJSONArray(0).getDouble(7);
        }
    } else {
        switch (idx) {
        case 0:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx).getDouble(4);
            break;
        default:
            preclose = quoteData.getJSONArray("K").getJSONArray(idx - 1).getDouble(4);
            break;
        }
        if (quoteData.getJSONArray("K").length() == 1) {
            preclose = quoteData.getDouble("zrsp");//quoteData.getJSONArray("K").getJSONArray(0).getDouble(4);
        }
    }
    //      if(quoteData.getJSONArray("K").length()==1 && quoteData.getJSONObject("todayData")!=null){
    //         preclose = quoteData.getJSONObject("todayData").getDouble("zrsp");
    //      }
    mPaint.setColor(getcolor(jrkp, preclose));
    canvas.drawText(Utils.dataFormation(jrkp, stockdigit), klineX, axisLabelHeight * 2, mPaint);
    mPaint.setColor(getcolor(zg, preclose));
    canvas.drawText(Utils.dataFormation(zg, stockdigit), klineX, axisLabelHeight * 4, mPaint);
    mPaint.setColor(getcolor(zd, preclose));
    canvas.drawText(Utils.dataFormation(zd, stockdigit), klineX, axisLabelHeight * 6, mPaint);
    mPaint.setColor(getcolor(sp, preclose));
    canvas.drawText(Utils.dataFormation(sp, stockdigit), klineX, axisLabelHeight * 8, mPaint);
    double zhangdie = sp - preclose;
    if (zhangdie > 0)
        mPaint.setColor(GlobalColor.colorpriceUp);
    else if (zhangdie < 0)
        mPaint.setColor(GlobalColor.colorPriceDown);
    else
        mPaint.setColor(GlobalColor.colorPriceEqual);
    canvas.drawText(Utils.dataFormation(zhangdie, 1), klineX, axisLabelHeight * 10, mPaint);
    if (quoteData.getString("period").equals("min5") || quoteData.getString("period").equals("min15")
            || quoteData.getString("period").equals("min30") || quoteData.getString("period").equals("min60")) {
        qt = qt.substring(4, 6) + '/' + qt.substring(6, 8) + ' ' + qt.substring(8);
    } else {
        qt = qt.substring(2, 4) + qt.substring(4, 6) + qt.substring(6, 8);
    }
    mPaint.setColor(GlobalColor.colorLabelName);
    canvas.drawText(qt, klineX, axisLabelHeight * 12, mPaint);
}

From source file:com.cssweb.android.view.PriceMini.java

public void drawPrice(Canvas canvas) {
    //canvas.restore();
    Paint paint = this.mPaint;
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setAntiAlias(true);//from w  w  w.j  a va 2s. c  o  m
    if (quoteData != null) {
        try {
            JSONArray jArr = quoteData.getJSONArray("data");
            JSONObject jo = jArr.getJSONObject(0);
            String str = "";
            double zrsp = jo.getDouble("zrsp");

            double zjcj = jo.getDouble("zjcj");
            paint.setTextSize(mTextSize * 2);
            setColor(paint, zjcj, zrsp);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(DX, DY * 2f);
            canvas.drawText(Utils.dataFormation(zjcj, stockdigit), x, y, paint);

            paint.setStyle(Paint.Style.STROKE);
            paint.setTextSize(mTextSize);

            double zhangd = jo.getDouble("zd");
            if (zhangd < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangd > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(-DX / 2, DY * 0.8f);
            String zhangdie = Utils.dataFormation(zhangd, stockdigit, jo.getInt("tp"));
            if (zhangdie.equals("-"))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangdie, x, y, paint);

            double zhangf = jo.getDouble("zf");
            if (zhangf < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangf > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(DX * 2.5f, 0);
            //String zhangfu = Utils.dataFormation(zhangf*100, stockdigit);
            //?????2?
            String zhangfu = Utils.dataFormation(zhangf * 100, 1, jo.getInt("tp"));
            if (zhangfu.equals("-") || zhangfu.equals(""))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangfu + "%", x, y, paint);

            paint.setColor(GlobalColor.colorLabelName);
            canvas.translate(-DX * 3, DY * 1.2f);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("?", x, y, paint);

            canvas.translate(DX * 2, -DY * 4);
            for (int i = 1; i <= 5; i++) {
                double temp2 = jo.getDouble("sjw" + i);
                setColor(paint, temp2, zrsp);
                str = Utils.dataFormation(temp2, stockdigit, jo.getInt("tp"));
                canvas.drawText(str, x, y, paint);
                if (i != 5)
                    canvas.translate(0, DY);
            }

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(width / 2 - DX * 2, -DY * 4);
            for (int i = 1; i <= 5; i++) {
                paint.setTextAlign(Paint.Align.RIGHT);
                canvas.drawText(Utils.getAmountFormat(jo.getInt("ssl" + i), false), x - tips, y, paint);
                if (i != 5)
                    canvas.translate(0, DY);
            }

            paint.setColor(GlobalColor.colorLabelName);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(0, -DY * 7);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);

            //paint.setTextAlign(Paint.Align.CENTER);
            canvas.translate(DX * 2, -DY * 7);
            double jrkp = jo.getDouble("jrkp");
            setColor(paint, jrkp, zrsp);
            canvas.drawText(Utils.dataFormation(jrkp, stockdigit, jo.getInt("tp")), x, y, paint);

            canvas.translate(0, DY);
            double zg = jo.getDouble("zgcj");
            setColor(paint, zg, zrsp);
            canvas.drawText(Utils.dataFormation(zg, stockdigit, jo.getInt("tp")), x, y, paint);

            canvas.translate(0, DY);
            double zd = jo.getDouble("zdcj");
            setColor(paint, zd, zrsp);
            canvas.drawText(Utils.dataFormation(zd, stockdigit, jo.getInt("tp")), x, y, paint);

            canvas.translate(0, DY);
            for (int i = 1; i <= 5; i++) {
                double temp2 = jo.getDouble("bjw" + i);
                setColor(paint, temp2, zrsp);
                str = Utils.dataFormation(temp2, stockdigit, jo.getInt("tp"));
                canvas.drawText(str, x, y, paint);
                if (i != 5)
                    canvas.translate(0, DY);
            }

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(width / 2 - DX * 2, -DY * 4);
            for (int i = 1; i <= 5; i++) {
                paint.setTextAlign(Paint.Align.RIGHT);
                canvas.drawText(Utils.getAmountFormat(jo.getInt("bsl" + i), false), x - tips, y, paint);
                if (i != 5)
                    canvas.translate(0, DY);
            }
        } catch (JSONException e) {
            Log.e(TAG, e.toString());
        }
    } else {//?????
        paint.setTextAlign(Paint.Align.LEFT);
        paint.setColor(GlobalColor.colorLabelName);

        canvas.translate(DX, DY * 2f);
        canvas.drawText("-", x, y, paint);

        paint.setStyle(Paint.Style.STROKE);
        paint.setTextSize(mTextSize);

        canvas.translate(-DX / 2, DY * 0.8f);
        canvas.drawText("-", x, y, paint);

        canvas.translate(DX * 2.5f, 0);
        canvas.drawText("-", x, y, paint);
        canvas.translate(-DX * 3, DY * 1.2f);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("?", x, y, paint);

        paint.setTextAlign(Paint.Align.LEFT);
        canvas.translate(width / 2, -DY * 7);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
    }
}

From source file:com.wanikani.androidnotifier.graph.HistogramPlot.java

@Override
protected void onDraw(Canvas canvas) {
    float left, right, tagLabelBaseline;
    int d, lo, hi, ascent;
    Samples bar;//w ww  .j  av  a 2 s .com

    canvas.drawLine(meas.plotArea.left, meas.plotArea.bottom, meas.plotArea.right, meas.plotArea.bottom,
            pas.axisPaint);
    lo = vp.leftmostBar() - 1; /* We want broken bars too :) */
    hi = vp.rightmostBar() + 1;

    ascent = (int) pas.labelPaint.getFontMetrics().ascent;

    tagLabelBaseline = meas.plotArea.bottom - ascent + meas.headroom / 2;

    for (d = lo; d <= hi; d++) {

        if (d < 0)
            continue;

        if (d >= bars.size())
            break;

        left = vp.getRelPosition(d);
        right = left + vp.meas.dipPerBar;
        bar = bars.get(d);

        drawBar(canvas, bar, left, right);

        canvas.drawText(bar.tag, (left + right) / 2, tagLabelBaseline, pas.labelPaint);
    }

    if (meas.yaxisGrid > 0) {
        for (d = meas.yaxisGrid; vp.getY(d) >= meas.plotArea.top; d += meas.yaxisGrid) {
            canvas.drawLine(meas.plotArea.left, vp.getY(d), meas.plotArea.right, vp.getY(d), pas.gridPaint);
        }
    }
}

From source file:com.cocosw.accessory.views.layout.CollapsingTitleLayout.java

@Override
public void draw(Canvas canvas) {
    final int saveCount = canvas.save();

    final int toolbarHeight = mToolbar.getHeight();
    canvas.clipRect(0, 0, canvas.getWidth(), interpolate(canvas.getHeight(), toolbarHeight, mScrollOffset));

    // Now call super and let it draw the background, etc
    super.draw(canvas);

    if (mTitleToDraw != null) {
        float x = mTextLeft;
        float y = mTextTop;

        if (!mUseTexture) {
            // If we're not drawing a texture, we need to properly offset the text
            x -= mDrawnTextBounds.left;//  w w  w .j ava 2s.  co m
            y -= mDrawnTextBounds.top;
        }

        if (DEBUG_DRAW) {
            // Just a debug tool, which drawn a Magneta rect in the text bounds
            canvas.drawRect(mTextLeft, mTextTop, mTextRight, mTextTop + mDrawnTextBounds.height(),
                    DEBUG_DRAW_PAINT);
        }

        if (mScale != 1f) {
            canvas.scale(mScale, mScale, x, y);
        }

        if (mUseTexture && mExpandedTitleTexture != null) {
            // If we should use a texture, draw it instead of text
            canvas.drawBitmap(mExpandedTitleTexture, x, y, mTexturePaint);
        } else {
            canvas.drawText(mTitleToDraw, x, y, mTextPaint);
        }
    }

    canvas.restoreToCount(saveCount);
}

From source file:com.travel.ac.view.UnderlinePageIndicator.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mViewPager == null) {
        return;//from  ww  w.j a  va  2 s  .  c  o m
    }
    final int count = mViewPager.getAdapter().getCount();
    if (count == 0) {
        return;
    }

    if (mCurrentPage >= count) {
        setCurrentItem(count - 1);
        return;
    }

    final int paddingLeft = getPaddingLeft();
    final float pageWidth = (getWidth() - paddingLeft - getPaddingRight()) / (1f * count);
    final float left = paddingLeft + pageWidth * (mCurrentPage + mPositionOffset);

    final float textleft = paddingLeft + pageWidth;
    final float right = left + pageWidth;
    final float top = getHeight() - getPaddingBottom() - mTabLineHeight;
    final float title_bottom = getHeight() - getPaddingBottom() - mTabLineHeight;
    final float bottom = getHeight() - getPaddingBottom();
    if (mTitles != null && mTitles.length > 0) {
        for (int i = 0; i < mTitles.length; i++) {
            if (mCurrentPage == i) {
                mTextPaint.setColor(Color.RED);
            } else {
                mTextPaint.setColor(Color.BLACK);
            }
            canvas.drawText(mTitles[i], (pageWidth * i) + pageWidth / 3 + 0.5f, (top + mTabLineHeight) / 2,
                    mTextPaint);
        }
    }

    canvas.drawRect(left, top, right, bottom, mPaint);
}

From source file:com.metinkale.prayerapp.vakit.PrefsView.java

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    canvas.scale(0.8f, 0.8f, canvas.getWidth() / 2, canvas.getHeight() / 2);
    Object o = getValue();//from w  ww . j  a v a  2 s  . com
    boolean active = ((o instanceof Boolean) && o.equals(true)) || ((o instanceof Integer) && !o.equals(0))
            || ((o instanceof String) && !((String) o).startsWith("silent"));
    if (mPref == Pref.Vibration2) {
        active = !o.equals(-1);
    }
    mPaint.setColor(active ? 0xff03A9F4 : 0xffe0e0e0);
    int w = getHeight();
    canvas.drawCircle(w / 2, w / 2, w / 2, mPaint);

    int p = w / 7;
    mDrawable.setBounds(p, p, w - p, w - p);
    mDrawable.setColorFilter(active ? sCFActive : sCFInactive);
    mDrawable.draw(canvas);

    if ((mPref == Pref.Time) || (mPref == Pref.SabahTime) || (mPref == Pref.Silenter)) {
        int s = (Integer) getValue();

        if (s != 0) {
            mPaint.setColor(getResources().getColor(R.color.colorPrimaryDark));
            canvas.drawCircle(getWidth() * 0.78f, getHeight() * 0.78f, getWidth() / 4, mPaint);
            mPaint.setColor(Color.WHITE);
            mPaint.setTextAlign(Align.CENTER);
            mPaint.setTextSize(w / 5);
            mPaint.setTypeface(Typeface.DEFAULT_BOLD);
            canvas.drawText(s + "", w * 0.78f, w * 0.87f, mPaint);
        }
    } else if (mPref == Pref.Vibration2)

    {
        int s = (Integer) getValue();
        String txt = "";
        if (s == 0) {
            txt = "8";
        } else if (s == 1) {
            txt = "1";
        }
        mPaint.setColor(Color.BLACK);
        mPaint.setTextAlign(Align.CENTER);
        mPaint.setTextSize(w / 2);
        mPaint.setTypeface(Typeface.DEFAULT_BOLD);
        if (s == 0) {
            canvas.rotate(90, canvas.getWidth() / 2, canvas.getHeight() / 2);
            canvas.drawText(txt, w / 2, (w * 2) / 3, mPaint);
            canvas.rotate(-90, canvas.getWidth() / 2, canvas.getHeight() / 2);
        } else {
            canvas.drawText(txt, w / 2, w * 2 / 3, mPaint);
        }
    }
}

From source file:com.zzq.viewpagerindicator.TitlePageIndicator.java

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    if (mViewPager == null) {
        return;//from  ww w. ja v a  2  s.  c om
    }
    final int count = mViewPager.getAdapter().getCount();
    if (count == 0) {
        return;
    }

    ArrayList<Rect> bounds = calculateAllBounds(mPaintText);

    if (mCurrentPage >= count) {
        setCurrentItem(count - 1);
        return;
    }
    final int paddingLeft = getPaddingLeft();
    final float bottom = getHeight() - getPaddingBottom();

    // 
    mPaintText.setColor(mSelectedColor);
    int textWidthCount = 0;
    int textheightCount = 0;
    for (int i = 0; i < bounds.size(); i++) {
        int textWidth = bounds.get(i).right - bounds.get(i).left;
        int textheight = bounds.get(i).bottom - bounds.get(i).top;
        textWidthCount += textWidth;
        textheightCount += textheight;
    }

    int textSpace = (getWidth() - getPaddingLeft() - getPaddingRight() - textWidthCount) / (bounds.size() + 1);
    for (int i = 0; i < bounds.size(); i++) {
        int textWidth = bounds.get(i).right - bounds.get(i).left;
        int textheight = bounds.get(i).bottom - bounds.get(i).top;

        canvas.drawText(getTitle(i).toString(), textSpace + (textSpace + textWidth) * i, textheight,
                mPaintText);
    }
    // 
    mPaint.setColor(mLineColor);
    canvas.drawRect(getPaddingLeft(), bottom - mBaseIndicatorLineHeight, getWidth() - getPaddingRight(), bottom,
            mPaint);
    // 
    int lineWidth = (getWidth() - getPaddingLeft() - getPaddingRight() - (bounds.size() * 2) * mHorizontalSpace)
            / (bounds.size());
    mPaint.setColor(mSelectedColor);
    final float left = paddingLeft + mHorizontalSpace
            + (lineWidth + mHorizontalSpace) * (mCurrentPage + mPositionOffset);
    final float right = left + (lineWidth + mHorizontalSpace);
    canvas.drawRect(left, bottom - mIndicatorLineHeight, right, bottom, mPaint);

}