我动态地添加和删除视图到自定义视图(FrameLayout)执行此操作:
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mMyView = inflater.inflate(resId, this, true);
稍后我尝试删除视图,但视图不会删除:
removeView(mMyView);
如果我这样做,一切都按预期工作:
mMyView = inflater.inflate(resId, this, **false**); addView(mMyView);
唯一的区别是我手动添加视图而不是让inflate调用.有谁知道为什么这会有所作为?