DialogTitlepublic class DialogTitle extends android.widget.TextView Used by dialogs to change the font size and number of lines to try to fit
the text to the available space. |
Methods Summary |
---|
protected void | onMeasure(int widthMeasureSpec, int heightMeasureSpec)
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final Layout layout = getLayout();
if (layout != null) {
final int lineCount = layout.getLineCount();
if (lineCount > 0) {
final int ellipsisCount = layout.getEllipsisCount(lineCount - 1);
if (ellipsisCount > 0) {
setSingleLine(false);
TypedArray a = mContext.obtainStyledAttributes(
android.R.style.TextAppearance_Medium,
android.R.styleable.TextAppearance);
final int textSize = a.getDimensionPixelSize(
android.R.styleable.TextAppearance_textSize, 20);
setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
setMaxLines(2);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
}
|
|