summaryrefslogtreecommitdiff
path: root/samples/ApiDemos/src
diff options
context:
space:
mode:
Diffstat (limited to 'samples/ApiDemos/src')
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/view/LabelView.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/LabelView.java b/samples/ApiDemos/src/com/example/android/apis/view/LabelView.java
index b98a5b573..b0a1f963b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/LabelView.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/LabelView.java
@@ -84,7 +84,8 @@ public class LabelView extends View {
private final void initLabelView() {
mTextPaint = new Paint();
mTextPaint.setAntiAlias(true);
- mTextPaint.setTextSize(16);
+ // Must manually scale the desired text size to match screen density
+ mTextPaint.setTextSize(16 * getResources().getDisplayMetrics().density);
mTextPaint.setColor(0xFF000000);
setPadding(3, 3, 3, 3);
}
@@ -104,6 +105,7 @@ public class LabelView extends View {
* @param size Font size
*/
public void setTextSize(int size) {
+ // This text size has been pre-scaled by the getDimensionPixelOffset method
mTextPaint.setTextSize(size);
requestLayout();
invalidate();