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 ?
I don't get this error anymore and this could have been totally to do with StickyHeaderListView being used. We removed the StickyHeaderListView and used standard android ListView and everything seems to be working fine.
If you are getting this warning in logs. Try removing custom ListView if any and replace with standard Android ListView and verify that this does not happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With