当我按下一个按钮,我想,一个充气观点出现,当我按下同一按钮此视图中消失......我怎么知道,如果一个充气观点存在
ViewGroup parent = (ViewGroup) findViewById(R.id.inflate_place);
View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.inflate_find, null);
for(int i=0; i<parent.getChildCount(); ++i) {
View nextChild = parent.getChildAt(i);
// Here i want that if is the same layout, this disappear
if (nextChild.equals(view)) {
parent.removeView(nextChild);
return;
}
}
parent.addView(view);