FileDocCategorySizeDatePackage
DialogTitle.javaAPI DocAndroid 5.1 API2753Thu Mar 12 22:22:10 GMT 2015com.android.internal.widget

DialogTitle

public 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.

Fields Summary
Constructors Summary
public DialogTitle(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)

        super(context, attrs, defStyleAttr, defStyleRes);
    
public DialogTitle(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)

        super(context, attrs, defStyleAttr);
    
public DialogTitle(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
    
public DialogTitle(android.content.Context context)

        super(context);
    
Methods Summary
protected voidonMeasure(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);
                    setMaxLines(2);

                    final TypedArray a = mContext.obtainStyledAttributes(null,
                            android.R.styleable.TextAppearance, android.R.attr.textAppearanceMedium,
                            android.R.style.TextAppearance_Medium);
                    final int textSize = a.getDimensionPixelSize(
                            android.R.styleable.TextAppearance_textSize, 0);
                    if (textSize != 0) {
                        // textSize is already expressed in pixels
                        setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
                    }
                    a.recycle();

                    super.onMeasure(widthMeasureSpec, heightMeasureSpec);      
                }
            }
        }