Android布局:运行第二个布局传递

Android布局:运行第二个布局传递,android,performance,android-layout,android-listview,Android,Performance,Android Layout,Android Listview,我正在扩展TextView并加载自定义字体。我正在列表视图中使用此自定义文本视图。当我滚动列表时,有时会收到以下调试消息 com.sample.CustomTextView{52afae4c V.ED....ID 0,27-27,44#7f060074 app:ID/some_ID}在布局期间未正确调用requestLayout():运行第二个布局过程 public class CustomTextView extends TextView { private FontType mFontTy

我正在扩展TextView并加载自定义字体。我正在列表视图中使用此自定义文本视图。当我滚动列表时,有时会收到以下调试消息

com.sample.CustomTextView{52afae4c V.ED....ID 0,27-27,44#7f060074 app:ID/some_ID}在布局期间未正确调用requestLayout():运行第二个布局过程

public class CustomTextView extends TextView {

private FontType mFontType;

public CustomTextView(Context context, AttributeSet attrs) {
    super(context, attrs, 0);
    if(!isInEditMode()){
        TypedArray attributesArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CustomTextView, 0, 0);
        try{
            mFontType = FontType.values()[attributesArray.getInteger(R.styleable.CustomTextView_fontType, 0)];
            setFontType(mFontType);
            setTypeface(Cache.getCustomTypeface(mContext, LIGHT));
            // Note: This flag is required for proper typeface rendering
            setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
        }finally {
            attributesArray.recycle();
        }
    }
}
}

但是,如果列表视图未滚动或首次加载,则不会打印此警告。我是否需要覆盖某些内容并设置任何标志?

我不再收到此错误,这可能完全与使用StickyHeaderListView有关。我们删除了StickyHeaderListView,使用了标准的android ListView,一切似乎都很正常


如果您在日志中收到此警告。尝试删除自定义ListView(如果有的话),并替换为标准Android ListView,并验证这不会发生。

您找到了解决方案吗?