I'm extending TextView and loading a custom typeface. I'm using this custom text view in a list view. When I scroll the list sometimes I get the following debug messages
requestLayout() improperly called by com.sample.CustomTextView{52afae4c V.ED.... ......ID 0,27-27,44 #7f060074 app:id/some_id} during layout: running second layout pass
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();
}
}
}
}
However this warning is not printed if the list view is not scrolling or when its loaded first time. Do i need to override something and set any flags ?