summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/widget/TextView.java22
-rw-r--r--docs/html/reference/images/text/widget/first_last_baseline.pngbin0 -> 22570 bytes
2 files changed, 19 insertions, 3 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index d358c95ba09b..34e3e3024516 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3270,14 +3270,22 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/**
* Updates the top padding of the TextView so that {@code firstBaselineToTopHeight} is
- * equal to the distance between the firt text baseline and the top of this TextView.
+ * the distance between the top of the TextView and first line's baseline.
+ * <p>
+ * <img src="{@docRoot}reference/android/images/text/widget/first_last_baseline.png" />
+ * <figcaption>First and last baseline metrics for a TextView.</figcaption>
+ *
* <strong>Note</strong> that if {@code FontMetrics.top} or {@code FontMetrics.ascent} was
* already greater than {@code firstBaselineToTopHeight}, the top padding is not updated.
+ * Moreover since this function sets the top padding, if the height of the TextView is less than
+ * the sum of top padding, line height and bottom padding, top of the line will be pushed
+ * down and bottom will be clipped.
*
* @param firstBaselineToTopHeight distance between first baseline to top of the container
* in pixels
*
* @see #getFirstBaselineToTopHeight()
+ * @see #setLastBaselineToBottomHeight(int)
* @see #setPadding(int, int, int, int)
* @see #setPaddingRelative(int, int, int, int)
*
@@ -3305,14 +3313,22 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/**
* Updates the bottom padding of the TextView so that {@code lastBaselineToBottomHeight} is
- * equal to the distance between the last text baseline and the bottom of this TextView.
+ * the distance between the bottom of the TextView and the last line's baseline.
+ * <p>
+ * <img src="{@docRoot}reference/android/images/text/widget/first_last_baseline.png" />
+ * <figcaption>First and last baseline metrics for a TextView.</figcaption>
+ *
* <strong>Note</strong> that if {@code FontMetrics.bottom} or {@code FontMetrics.descent} was
* already greater than {@code lastBaselineToBottomHeight}, the bottom padding is not updated.
+ * Moreover since this function sets the bottom padding, if the height of the TextView is less
+ * than the sum of top padding, line height and bottom padding, bottom of the text will be
+ * clipped.
*
* @param lastBaselineToBottomHeight distance between last baseline to bottom of the container
* in pixels
*
* @see #getLastBaselineToBottomHeight()
+ * @see #setFirstBaselineToTopHeight(int)
* @see #setPadding(int, int, int, int)
* @see #setPaddingRelative(int, int, int, int)
*
@@ -5184,7 +5200,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @param lineHeight the line height in pixels
*
* @see #setLineSpacing(float, float)
- * @see #getLineSpacing()
+ * @see #getLineSpacingExtra()
*
* @attr ref android.R.styleable#TextView_lineHeight
*/
diff --git a/docs/html/reference/images/text/widget/first_last_baseline.png b/docs/html/reference/images/text/widget/first_last_baseline.png
new file mode 100644
index 000000000000..ee3bd1f9712d
--- /dev/null
+++ b/docs/html/reference/images/text/widget/first_last_baseline.png
Binary files differ