3
我在擴展TextView並加載自定義字體。我在列表視圖中使用此自定義文本視圖。當我滾動列表有時我得到以下調試消息Android佈局:運行第二個佈局傳遞
requestLayout()不正確地調用com.sample.CustomTextView {52afae4c V.ED .... ...... ID 0,27-27,44 #7f060074應用程式:ID佈局期間/ SOME_ID}:在運行的第二佈局傳遞
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();
}
}
}
}
但是不打印該警告如果列表視圖不滾動或者其加載第一次時。我是否需要重寫某些內容並設置任何標誌?
你有沒有找到這方面的解決方案? – JAPS