其他分享
首页 > 其他分享> > Android FrameLayout等 设置子控件层级 控件最上层显示 顶层显示

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);
        }
    }

标签:控件,parent,mParent,link,FrameLayout,Android,view,View
来源: https://blog.csdn.net/mowwwcom/article/details/114592159