Share via


RenderNode.SetProjectBackwards(Boolean) Method

Definition

Sets whether the RenderNode should be drawn immediately after the closest ancestor RenderNode containing a projection receiver.

[Android.Runtime.Register("setProjectBackwards", "(Z)Z", "", ApiSince=29)]
public bool SetProjectBackwards (bool shouldProject);
[<Android.Runtime.Register("setProjectBackwards", "(Z)Z", "", ApiSince=29)>]
member this.SetProjectBackwards : bool -> bool

Parameters

shouldProject
Boolean

true if the display list should be projected onto a containing volume. Default is false.

Returns

True if the value changed, false if the new value was the same as the previous value.

Attributes

Remarks

Sets whether the RenderNode should be drawn immediately after the closest ancestor RenderNode containing a projection receiver.

The default is false, and the rendering of this node happens in the typical draw order.

If true, then at rendering time this rendernode will not be drawn in order with the Canvas#drawRenderNode(RenderNode) command that drew this RenderNode, but instead it will be re-positioned in the RenderNode tree to be drawn on the closet ancestor with a child rendernode that has #setProjectionReceiver(boolean) as true.

The typical usage of this is to allow a child RenderNode to draw on a parent's background, such as the platform's usage with android.graphics.drawable.RippleDrawable. Consider the following structure, built out of which RenderNode called drawRenderNode on a different RenderNode:

+-------------+
                   |RenderNode: P|
                   +-+----------++
                     |          |
                     v          v
             +-------+-----+  +-+--------------+
             |RenderNode: C|  |RenderNode: P'BG|
             +-------+-----+  +----------------+
                     |
                     |
            +--------+-------+
            |RenderNode: C'BG|
            +----------------+

If P'BG is a projection receiver, and C'BG is set to project backwards then C'BG will behave as if it was drawn directly by P'BG instead of by C. This includes inheriting P'BG's clip instead of C's clip.

Java documentation for android.graphics.RenderNode.setProjectBackwards(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to