summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/gallery3d/filtershow/category/IconView.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/category/IconView.java b/src/com/android/gallery3d/filtershow/category/IconView.java
index 089203acf..4823cd1a6 100644
--- a/src/com/android/gallery3d/filtershow/category/IconView.java
+++ b/src/com/android/gallery3d/filtershow/category/IconView.java
@@ -108,10 +108,16 @@ public class IconView extends View {
// justify to the left.
x = mMargin;
}
- int y = canvas.getHeight() / 2 ;//- 2*mMargin;
+ int y = canvas.getHeight() - getTextHeight(mPaint) / 2 - mMargin;
canvas.drawText(text, x, y, mPaint);
}
+ private int getTextHeight(Paint paint){
+ paint.setTextSize(mTextSize);
+ Paint.FontMetrics fontMetrics = paint.getFontMetrics();
+ return (int)(Math.ceil(fontMetrics.descent - fontMetrics.ascent) + 2);
+ }
+
protected void drawOutlinedText(Canvas canvas, String text) {
mPaint.setColor(getBackgroundColor());
mPaint.setStyle(Paint.Style.STROKE);