Skip to content

Commit

Permalink
Merge pull request #5803 from hieupham007/timob-17155
Browse files Browse the repository at this point in the history
[TIMOB-17155]: Android - re-add child view with correct index.
  • Loading branch information
vishalduggal committed Jun 16, 2014
2 parents ee98234 + f9914bf commit 867311b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1178,16 +1178,18 @@ private void initializeBorder(KrollDict d, Integer bgColor)
// If the view already has a parent, we need to detach it from the parent
// and add the borderView to the parent as the child
ViewGroup savedParent = null;
int childIndex = -1;
if (nativeView.getParent() != null) {
ViewParent nativeParent = nativeView.getParent();
if (nativeParent instanceof ViewGroup) {
savedParent = (ViewGroup) nativeParent;
childIndex = savedParent.indexOfChild(nativeView);
savedParent.removeView(nativeView);
}
}
borderView.addView(nativeView, params);
if (savedParent != null) {
savedParent.addView(borderView, getLayoutParams());
savedParent.addView(borderView, childIndex, getLayoutParams());
}
borderView.setVisibility(this.visibility);
}
Expand Down

0 comments on commit 867311b

Please sign in to comment.