Code example for Layout

Methods: getLineBottom

0
	 * Get how many lines of text we can display so their full height is visible. 
	 */ 
	private int getFullyVisibleLinesCount() { 
		Layout layout = createWorkingLayout("");
		int height = getHeight() - getPaddingTop() - getPaddingBottom();
		int lineHeight = layout.getLineBottom(0);
		return height / lineHeight;
	} 
 
	private Layout createWorkingLayout(String workingText) {
		return new StaticLayout(workingText, getPaint(),
				getWidth() - getPaddingLeft() - getPaddingRight(),
				Alignment.ALIGN_NORMAL, lineSpacingMultiplier,
				lineAdditionalVerticalPadding, false /* includepad */);
	} 
 
	@Override 
	public void setEllipsize(TruncateAt where) {
		// Ellipsize settings are not respected 
	} 
}