OSDN Git Service

Workaround fading edge incompatibility with alpha modulation
authorChris Craik <ccraik@google.com>
Fri, 11 Oct 2013 19:51:11 +0000 (12:51 -0700)
committerChris Craik <ccraik@google.com>
Fri, 11 Oct 2013 19:55:42 +0000 (12:55 -0700)
bug:11121809

Fading edges, such as drawn by a scrolling marquee TextView, don't
behave correctly when their view is modulated, as done by the view
system when alpha is set on a view that returns false from
hasOverlappingRendering.

To work around this, always return true from hasOverlappingRendering
if a TextView has horizontal fading edges enabled.

Change-Id: I64c9b8c653aa1d9ca320292306fd24333e3ee225

core/java/android/widget/TextView.java

index 61e071b..cb930d6 100644 (file)
@@ -4870,8 +4870,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
 
     @Override
     public boolean hasOverlappingRendering() {
+        // horizontal fading edge causes SaveLayerAlpha, which doesn't support alpha modulation
         return ((getBackground() != null && getBackground().getCurrent() != null)
-                || mText instanceof Spannable || hasSelection());
+                || mText instanceof Spannable || hasSelection()
+                || isHorizontalFadingEdgeEnabled());
     }
 
     /**