Example usage for android.text Layout getLineCount

List of usage examples for android.text Layout getLineCount

Introduction

In this page you can find the example usage for android.text Layout getLineCount.

Prototype

public abstract int getLineCount();

Source Link

Document

Return the number of lines of text in this layout.

Usage

From source file:android.support.v7.widget.Toolbar.java

/** @hide */
public boolean isTitleTruncated() {
    if (mTitleTextView == null) {
        return false;
    }//from  w ww .  j a v  a2  s .  co  m

    final Layout titleLayout = mTitleTextView.getLayout();
    if (titleLayout == null) {
        return false;
    }

    final int lineCount = titleLayout.getLineCount();
    for (int i = 0; i < lineCount; i++) {
        if (titleLayout.getEllipsisCount(i) > 0) {
            return true;
        }
    }
    return false;
}