public class MultiViewParallaxTransformer
extends java.lang.Object
R.id.myview,
then all Views with that resource ID will have a 20% parallax effect. This means that when the
page is scrolled in some direction by some number of pixels (call this variable x), then the
affected views will be scrolled 1.2*x pixels in the same direction.
This class can safely be used with ViewPager instances where not all pages have the same
views/layout.| Constructor and Description |
|---|
MultiViewParallaxTransformer() |
| Modifier and Type | Method and Description |
|---|---|
android.view.View |
getViewToTransform(android.view.View rootView,
int id)
Returns a reference to the child view of
rootView with the resource ID of id. |
static MultiViewParallaxTransformer |
newInstance()
Constructs a new MultiViewParallaxTransformer instance.
|
void |
transformPage(android.view.View page,
float position) |
MultiViewParallaxTransformer |
withoutParallaxView(int id)
Removes a parallax effect from all Views with the provided resource id.
|
MultiViewParallaxTransformer |
withParallaxView(int id,
float parallaxFactor)
Sets this MultiViewParallaxTransformer to apply a parallax effect to all Views with the
provided resource id.
|
public void transformPage(android.view.View page,
float position)
public static MultiViewParallaxTransformer newInstance()
public MultiViewParallaxTransformer withParallaxView(int id, float parallaxFactor)
id - the resource ID of the views to apply the parallax effect toparallaxFactor - determines how fastpublic MultiViewParallaxTransformer withoutParallaxView(int id)
id - the resource if of the Views to remove the effect frompublic android.view.View getViewToTransform(android.view.View rootView,
int id)
rootView with the resource ID of id.
Using this method is more efficient that frequent calls to View.findViewById(int).rootView - the view to get the child view from, not nullid - the resource ID of the child viewrootView with the resource ID of id, or null if no
such child view exists