我在显示listview时实现了listview自定义适配器,下面显示了如何解决它。
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 :(得分:7)
RelativeLayout是一个布局,你在膨胀吗?如果是,则尝试更改行
view = vi.inflate(R.layout.listitemrow, null);
到这个
view = vi.inflate(R.layout.listitemrow, parent, false);