Skip to content

Commit

Permalink
* [android] ClipPath doesn't work when the following conditions met
Browse files Browse the repository at this point in the history
  1. rotation or scale is used
  2. API level is 24
As border-radius uses clipPath, this will cause views with border-radius using rotation or scale on API level 24 doesn't.
So far, this is a bug of Android N,https://code.google.com/p/android/issues/detail?id=225556&sort=-id&colspec=ID

Whether this bug is fixed on API 25 or higher is unknown so far, so ClipPath will be disabled when API level is 24 or higher.
  • Loading branch information
YorkShen committed Feb 9, 2017
1 parent b0baa0f commit f69e918
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,12 @@ public static void clipCanvasWithinBorderBox(View targetView, Canvas canvas) {
/* According to https://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported
API 18 or higher supports clipPath to canvas based on hardware acceleration.
*/
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ||
!canvas.isHardwareAccelerated()) &&
/**
* According to https://code.google.com/p/android/issues/detail?id=225556&sort=-id&colspec=ID
* clipPath doesn't work with rotation nor scale when API level is 24 or higher.
*/
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 || !canvas.isHardwareAccelerated()) &&
Build.VERSION.SDK_INT <= Build.VERSION_CODES.M &&
((drawable = targetView.getBackground()) instanceof BorderDrawable)) {
BorderDrawable borderDrawable = (BorderDrawable) drawable;
if(borderDrawable.isRounded()) {
Expand Down

0 comments on commit f69e918

Please # to comment.