Workaround fading edge incompatibility with alpha modulation

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
This commit is contained in:
Chris Craik
2013-10-11 12:51:11 -07:00
parent c37db9c0de
commit 7bcde5009d

View 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());
}
/**