gpt4 book ai didi

java - android.widget.RelativeLayout android 不正确调用 requestLayout()

转载 作者:塔克拉玛干 更新时间:2023-11-02 18:50:53 33 4
gpt4 key购买 nike

我在显示 listview 时实现了 listview customadapter,它在下面显示 warring how to reslove it。

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;
}

最佳答案

RelativeLayout是不是布局,你在膨胀?如果是,则尝试换行

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

对此

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

关于java - android.widget.RelativeLayout android 不正确调用 requestLayout(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21249935/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com