@@ -358,8 +358,8 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
358
358
return blockTouches && distanceFromFocus > showcaseDrawer .getBlockedRadius ();
359
359
}
360
360
361
- private static void insertShowcaseView (ShowcaseView showcaseView , Activity activity ) {
362
- (( ViewGroup ) activity . getWindow (). getDecorView ()). addView (showcaseView );
361
+ private static void insertShowcaseView (ShowcaseView showcaseView , ViewGroup parent , int parentIndex ) {
362
+ parent . addView (showcaseView , parentIndex );
363
363
if (!showcaseView .hasShot ()) {
364
364
showcaseView .show ();
365
365
} else {
@@ -403,6 +403,9 @@ public static class Builder {
403
403
final ShowcaseView showcaseView ;
404
404
private final Activity activity ;
405
405
406
+ private ViewGroup parent ;
407
+ private int parentIndex ;
408
+
406
409
public Builder (Activity activity ) {
407
410
this (activity , false );
408
411
}
@@ -417,6 +420,9 @@ public Builder(Activity activity, boolean useNewStyle) {
417
420
this .activity = activity ;
418
421
this .showcaseView = new ShowcaseView (activity , useNewStyle );
419
422
this .showcaseView .setTarget (Target .NONE );
423
+
424
+ this .parent = ((ViewGroup ) activity .getWindow ().getDecorView ());
425
+ this .parentIndex = -1 ;
420
426
}
421
427
422
428
/**
@@ -425,7 +431,7 @@ public Builder(Activity activity, boolean useNewStyle) {
425
431
* @return the created ShowcaseView
426
432
*/
427
433
public ShowcaseView build () {
428
- insertShowcaseView (showcaseView , activity );
434
+ insertShowcaseView (showcaseView , parent , parentIndex );
429
435
return showcaseView ;
430
436
}
431
437
@@ -559,6 +565,12 @@ public Builder setShowcaseEventListener(OnShowcaseEventListener showcaseEventLis
559
565
return this ;
560
566
}
561
567
568
+ public Builder setParent (ViewGroup parent , int index ) {
569
+ this .parent = parent ;
570
+ this .parentIndex = index ;
571
+ return this ;
572
+ }
573
+
562
574
/**
563
575
* Sets the paint that will draw the text as specified by {@link #setContentText(CharSequence)}
564
576
* or {@link #setContentText(int)}
0 commit comments