Andrei Vinogradov
Andrei Vinogradov

Reputation: 1935

Deprecation of Android's Canvas.clipRect()

Since Android's API 26 Canvas.clipRect(float, float, float, float, Region.Op) is deprecated. In my custom view I use that method with Region.Op.REPLACE as last argument. I just want to know possible replacement of that deprecated method call with same functionality. I did not find clear answer for my question in documentation. Thanks.

Upvotes: 1

Views: 2417

Answers (1)

veritas1
veritas1

Reputation: 9170

My understanding from the docs (https://developer.android.com/reference/android/graphics/Canvas.html#clipRect) - is that expanding the canvas clip size (with Region.Op.REPLACE) was never a desired use case, as the suggested replacement methods do not have that functionality.

However, you can continue to draw outside the clip bounds in your custom view and request the parent view does not clip it's children with

android:clipChildren="false" 

Upvotes: 3

Related Questions