Reputation: 989
I have a ViewPager
containing Fragment
s, each containing a single TextView
. I'm creating a parallax effect by calling TextView.setShadowLayer(...)
to an offset based on the position of the TextView
on screen. It all works great, but has one hiccup. The TextView
s each have two lines of different lengths (center gravity), and as each line moves off screen, that line's shadow also disappears abruptly. It creates an effect where the two lines of the same TextView
have shadows that disappear abruptly at different times, when I want them to stay visible until the shadow itself is off screen.
I'm pretty sure it's something specific to TextView
due to the shadow disappearing based on the line and not the overall view position. Is there a way to force onDraw()
even when a View
, or a line of TextView
is off screen?
Upvotes: 1
Views: 154
Reputation: 5207
Basically you cant call onDraw()
when until the view is visible but it can be done on unity using some thing like culling
.
besides that just to give a shadow to the TextView you should use a backgound image with a little transparency.
Hope it help:)
Upvotes: 1