diff --git a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java index 8e94cd52..2a8c6734 100644 --- a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java +++ b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java @@ -89,7 +89,11 @@ public void onGlobalLayout() { layoutParams.bottomMargin = ViewUtil.getNavBarHeight(mContext); } - + //If this child view is already added to the parent rootView, then remove it first + ViewGroup parent = (ViewGroup) FilterableListView.this.getParent(); + if (parent != null) { + parent.removeView(FilterableListView.this); + } // add view rootView.addView(FilterableListView.this, layoutParams);