解决方案
30
估计是你的子ListView的适配器在父ListView适配器的getView中重复创建了吧,嵌套ListView 适配器一般是这样写
public View getView(int position, View view, ViewGroup parent) {
if (view == null)
{
view = LayoutInflater.from(context).inflate(…..);
ViewHandle viewHandle = new ViewHandle();
viewHandle .childAdapter= new ChildAdapter ();
viewHandle .ListView = view.findById(……);
viewHandle .ListView.setAdapter(viewHandle .childAdapter);
view.setTag(viewHandle );
}
ViewHandle mhandle = (ViewHandle )view.getTag();
mhandle .childAdapter.setList(mList);
}
private class ViewHandle
{
ListView listView;
ChildAdapter childAdapter;
}
public View getView(int position, View view, ViewGroup parent) {
if (view == null)
{
view = LayoutInflater.from(context).inflate(…..);
ViewHandle viewHandle = new ViewHandle();
viewHandle .childAdapter= new ChildAdapter ();
viewHandle .ListView = view.findById(……);
viewHandle .ListView.setAdapter(viewHandle .childAdapter);
view.setTag(viewHandle );
}
ViewHandle mhandle = (ViewHandle )view.getTag();
mhandle .childAdapter.setList(mList);
}
private class ViewHandle
{
ListView listView;
ChildAdapter childAdapter;
}
10
闪烁的原因 可能是 notifyDataChanged 刷新了把
10
xml里高度别用wrap_content,改成match_parent,之前看过一篇文章,高度会影响定位,从而引发多次刷新的问题