From 613ff560c9df26a0859c15e6d2fe4423c22f0f7e Mon Sep 17 00:00:00 2001 From: Emil Markose Date: Sat, 29 Jul 2017 22:02:55 +0530 Subject: [PATCH] Fix for Issue #46 --- .../com/pchmn/materialchips/views/FilterableListView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);