2014-01-21 61 views
8

我已經實現了listview customadapter在顯示列表視圖時顯示如何重新註冊它。requestLayout()由android.widget.RelativeLayout不正確地調用android

requestLayout() improperly called by android.widget.RelativeLayout{b42acc20 V.E..... ......ID 0,-52-480,0 #7f0700ec app:id/ptr_id_header} during layout: running second layout pass 

Java代碼

public View getView(int position, View convertView, ViewGroup parent) 
{ 
    View view = convertView; 
    if (view == null) 
    { 
     LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     view = vi.inflate(R.layout.listitemrow, null); 
    } 
    RssItem rssItem = mRssItemList.get(position); 
    if (rssItem != null) 
    { 
     TextView title = (TextView) view.findViewById(R.id.rowtitle); 
     if (title != null) 
     { 
      title.setText(rssItem.getTitle()); 
     } 
    } 
    return view; 
} 
+0

張貼一些更多的代碼。 – GrIsHu

+1

這個未答覆的問題可能已經在另一個線程上解決了:[Android:requestLayout()不當調用](http://stackoverflow.com/questions/24598977/android-requestlayout-improperly-called) – Fllo

回答

7

是RelativeLayout的佈局,會人爲增加?如果是的話,儘量線

view = vi.inflate(R.layout.listitemrow, null); 

改變這種

view = vi.inflate(R.layout.listitemrow, parent, false); 
+0

對不起,但我需要知道爲什麼它必須像這樣解決,不僅僅是上面的帖子:) – famfamfam

相關問題