1919 */
2020public class HighLight
2121{
22+ private static final String TAG = "anchorIsFrameLayout" ;
23+
2224 public static class ViewPosInfo
2325 {
2426 public int layoutId = -1 ;
@@ -142,7 +144,7 @@ public void show()
142144 ViewGroup .LayoutParams lp = new ViewGroup .LayoutParams
143145 (ViewGroup .LayoutParams .MATCH_PARENT , ViewGroup .LayoutParams .MATCH_PARENT );
144146 ((ViewGroup ) mAnchor ).addView (hightLightView , ((ViewGroup ) mAnchor ).getChildCount (), lp );
145-
147+ hightLightView . setTag ( TAG );
146148 } else
147149 {
148150 FrameLayout frameLayout = new FrameLayout (mContext );
@@ -154,6 +156,7 @@ public void show()
154156 frameLayout .addView (mAnchor , lp );
155157
156158 frameLayout .addView (hightLightView );
159+ hightLightView .setTag ("" );
157160 }
158161
159162 if (intercept )
@@ -175,13 +178,14 @@ public void remove()
175178 {
176179 if (mHightLightView == null ) return ;
177180 ViewGroup parent = (ViewGroup ) mHightLightView .getParent ();
178- if (parent instanceof RelativeLayout || parent instanceof FrameLayout )
181+ if (mHightLightView . getTag (). equals ( TAG ) )
179182 {
180183 parent .removeView (mHightLightView );
181184 } else
182185 {
183186 parent .removeView (mHightLightView );
184187 View origin = parent .getChildAt (0 );
188+ parent .removeView (origin );
185189 ViewGroup graParent = (ViewGroup ) parent .getParent ();
186190 graParent .removeView (parent );
187191 graParent .addView (origin , parent .getLayoutParams ());
0 commit comments