> It seems on official Android 4.0.2 on the GN there's a slight stutter
> when starting to scroll a page for the first time, but removing the
> call to         setLayerType(LAYER_TYPE_HARDWARE, null); does prevent
> the stutter. I didn't notice a difference on AOSP Android 4.0.3 on the
> GN (and official 4.0.3 on the NS, but lower resolution which effects
> things also).

Using a layer will cause the first draw to allocate a graphics buffer,
thus possibly skipping a frame. I believe the Launcher team fixed that
by allocating the buffers ahead of time in 4.0.3.

> Also interestingly, the animation does a setAlpha and the
> documentation 
> http://developer.android.com/reference/android/view/View.html#setAlpha(float)
> states that this implies calling setLayerType with a hardware layer.

It won't change the layer type but the performance profile will be the
same. I should probably clarify this in the documentation. If you only
call setAlpha() the view will be rendered into a graphics buffer on
every frame. This buffer will then be copied on screen. If you use
setLayerType() however, the view will be rendered into a graphics
buffer *once*. Using setLayerType() is much more efficient. Once
you've set a layer on a View, setAlpha() applies directly to the
layer. You can also use the Paint supplied with the call to
setLayerType() to change the alpha.


-- 
Romain Guy
Android framework engineer
[email protected]

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to