BringToFront doesn't work inside a coordinator layout

前端 未结 3 1388
谎友^
谎友^ 2021-01-07 17:17
Android Studio 2.0 Preview 4

I am using to use BringToFront to get a TextView to display in front of the other controls.<

3条回答
  •  Happy的楠姐
    2021-01-07 17:40

    Prior to KITKAT this method should be followed by calls to requestLayout() and invalidate() on the view's parent to force the parent to redraw with the new child ordering.

    These methods have to be called on the view's parent. You are calling them on the view itself.

    This should work.

    tvLevel.bringToFront();
    tvLevel.getParent().requestLayout();
    tvLevel.getParent().invalidate();
    

提交回复
热议问题