leanback/src/main/java/androidx/leanback/widget/ShadowOverlayContainer.java
public void wrap(View view) {
        if (!mInitialized || mWrappedView != null) {
            throw new IllegalStateException();
        }
        ViewGroup.LayoutParams lp = view.getLayoutParams();
        if (lp != null) {
            // if wrapped view has layout params, inherit everything but width/height.
            // Wrapped view is assigned a FrameLayout.LayoutParams with width and height only.
            // Margins, etc are assigned to the wrapper and take effect in parent container.
            ViewGroup.LayoutParams wrapped_lp = new FrameLayout.LayoutParams(lp.width, lp.height);
            // Uses MATCH_PARENT for MATCH_PARENT, WRAP_CONTENT for WRAP_CONTENT and fixed size,
            // App can still change wrapped view fixed width/height afterwards.
            lp.width = lp.width == LayoutParams.MATCH_PARENT
                    ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
            lp.height = lp.height == LayoutParams.MATCH_PARENT
                    ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
            this.setLayoutParams(lp);
            addView(view, wrapped_lp);
        } else {
            addView(view);
        }
        if (mRoundedCorners && mShadowType != SHADOW_DYNAMIC) {
            RoundedRectHelper.setClipToRoundedOutline(this, true);
        }
        mWrappedView = view;
    }
/**
     * Inserts view into the wrapper.
     */
Inserts view into the wrapper.
Inserts view into the wrapper .
public void wrap(View view) {
        if (!mInitialized || mWrappedView != null) {
            throw new IllegalStateException();
        }
        ViewGroup.LayoutParams lp = view.getLayoutParams();
        if (lp != null) {
            ViewGroup.LayoutParams wrapped_lp = new FrameLayout.LayoutParams(lp.width, lp.height);
            lp.width = lp.width == LayoutParams.MATCH_PARENT
                    ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
            lp.height = lp.height == LayoutParams.MATCH_PARENT
                    ? LayoutParams.MATCH_PARENT : LayoutParams.WRAP_CONTENT;
            this.setLayoutParams(lp);
            addView(view, wrapped_lp);
        } else {
            addView(view);
        }
        if (mRoundedCorners && mShadowType != SHADOW_DYNAMIC) {
            RoundedRectHelper.setClipToRoundedOutline(this, true);
        }
        mWrappedView = view;
    }
public void wrap ( View view ) { if ( ! mInitialized || mWrappedView != null ) { throw new IllegalStateException ( ) ; } ViewGroup . LayoutParams lp = view . getLayoutParams ( ) ; if ( lp != null ) { ViewGroup . LayoutParams wrapped_lp = new FrameLayout . LayoutParams ( lp . width , lp . height ) ; lp . width = lp . width == LayoutParams . MATCH_PARENT ? LayoutParams . MATCH_PARENT : LayoutParams . WRAP_CONTENT ; lp . height = lp . height == LayoutParams . MATCH_PARENT ? LayoutParams . MATCH_PARENT : LayoutParams . WRAP_CONTENT ; this . setLayoutParams ( lp ) ; addView ( view , wrapped_lp ) ; } else { addView ( view ) ; } if ( mRoundedCorners && mShadowType != SHADOW_DYNAMIC ) { RoundedRectHelper . setClipToRoundedOutline ( this , true ) ; } mWrappedView = view ; }
Inserts view into the wrapper.
Inserts view into the wrapper .
// if wrapped view has layout params, inherit everything but width/height. // Wrapped view is assigned a FrameLayout.LayoutParams with width and height only. // Margins, etc are assigned to the wrapper and take effect in parent container. // Uses MATCH_PARENT for MATCH_PARENT, WRAP_CONTENT for WRAP_CONTENT and fixed size, // App can still change wrapped view fixed width/height afterwards.