Android FrameLayout等 设置子控件层级 控件最上层显示 顶层显示

View.java
view.bringToFront(); // 将view提高到最顶层显示

    /**
     * Change the view's z order in the tree, so it's on top of other sibling
     * views. This ordering change may affect layout, if the parent container
     * uses an order-dependent layout scheme (e.g., LinearLayout). Prior
     * to {@link android.os.Build.VERSION_CODES#KITKAT} this
     * method should be followed by calls to {@link #requestLayout()} and
     * {@link View#invalidate()} on the view's parent to force the parent to redraw
     * with the new child ordering.
     *
     * @see ViewGroup#bringChildToFront(View)
     */
    public void bringToFront() {
        if (mParent != null) {
            mParent.bringChildToFront(this);
        }
    }
posted @ 2022-03-12 22:04  xiaomodecnblogs  阅读(1904)  评论(0)    收藏  举报