FileDocCategorySizeDatePackage
DialogTitle.javaAPI DocAndroid 1.5 API2408Wed May 06 22:41:56 BST 2009com.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 defStyle)

        super(context, attrs, defStyle);
    
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);
                    
                    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);      
                }
            }
        }