I have a ViewPager with both clipToPadding and clipChildren set to false. The items in the pager have a drop shadow effect that is drawn below each item, outside of its bounds. This works just fine when the pager is static:
However, when animating between pages the children are clipped just as if clipChildren has been set:
The behaviour only occurs when the PageTransformer is set.
After digging around for quite a while i found the following post here on Stack overflow: Do not clip ViewPager pages. While similar, i did not suffer from the NoSaveStateFrameLayout issue the poster had. However in the comment to the accepted answer I found the following tidbit:
"[...] I had a PageTransformer on my ViewPager, but you couldn't know. I set the layer on my transformed View to NONE, and it worked."
So I tried doing the following in my PageTransformer:
public void transformPage(View view, float v) {
view.setLayerType(View.LAYER_TYPE_NONE, null);
}
This finally solved the problem. It should be noted that setting this when creating the element did not solve the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With