NativeScript: Let child view overflow AbsoluteLayout parent on Android
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
- CLI: 2.0.0
- Cross-platform modules: 2.0.0
- Runtime(s): tns-android 2.0.0
Please tell us how to recreate the issue in as much detail as possible.
Please try to test the below markup on iOS and Android. You will notice that the child view overflows the parent on iOS, but not on Android. Expected behaviour: the child view should overflow the parent if the parent is AbsoluteLayout.
iOS:
Android:
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
<Page xmlns="http://schemas.nativescript.org/tns.xsd" >
<GridLayout>
<AbsoluteLayout width="100" height="100" backgroundColor="green">
<GridLayout width="100" height="100" backgroundColor="red" top="20" left="-20">
</GridLayout>
</AbsoluteLayout>
</GridLayout>
</Page>
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 17 (6 by maintainers)
Hi, @tsonevn. I tried the provided solution you’ve mentioned above but it doesn’t work for me. However, I’ve managed to get this working by using native Android code for this problem:
if (app.android && platform.device.sdkVersion >= '21') { myView.android.setClipChildren(false) }
It would be great to have this featured exposed as a CSS overflow property in the upcoming version of NativeScript.
Thank you for answering!
From my experiment the native android solution ( from @carloscabral ) works, and needs to be applied to the target views grandparent.
Also RE original post, it’s worth noting that if the parent view has a background the child will be clipped. This issue is resolved by the native solution though (haven’t checked iOS native solution).
@carloscabral 💯
Ah, ok, might be is SDK >= 21 ? I remember when testing i had < 21 - but today - thats great news!
Thanks 👍
Hi @terreb ,
Thank you for your answer. Could your sent us some sample project, which we can use to review the behavior you needs. Regards