2014-02-27 29 views
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(); 
     } 
    } 
} 
} 

但是不打印該警告如果列表視圖不滾動或者其加載第一次時。我是否需要重寫某些內容並設置任何標誌?

+0

你有沒有找到這方面的解決方案? – JAPS

回答

2

我不會再遇到這個錯誤,這可能與使用StickyHeaderListView完全相關。我們刪除了StickyHeaderListView,並使用標準的Android ListView,一切似乎都正常工作。

如果您在日誌中收到此警告。嘗試刪除自定義ListView(如果有的話),並用標準的Android ListView替換,並驗證這沒有發生。