Status Update
Comments
js...@google.com <js...@google.com>
pa...@google.com <pa...@google.com> #2
So right now there is a limit of 30dp for elevation so this should work. Can you check if increasing padding at the bottom of the compose view fixes it? If yes, you might be facing an issue where there is another view in the hierarchy that is missing the following parameter android:clipToPadding="false"
[Deleted User] <[Deleted User]> #3
Adding padding of my own does fix the problem. None if the windows in the window clip their children but a few does have clipToPadding
enabled (the compose view, the content FrameLayout and the decor view).
One problem seems to be that Dialog
assumes that if you have an elevation of 30dp then the shadow length will also be 30dp which I don't think is correct. I believe the shadow length is proportional, but not linearly so, to the elevation.
pa...@google.com <pa...@google.com> #4
I don't think Dialog assumes shadow length. Dialog reserves a space for 30dp of elevation and lets the framework decide how much is that. The limit could be configurable in the future. It's honestly pretty tricky case and we struggled to find a more general solution for this.
pa...@google.com <pa...@google.com>
[Deleted User] <[Deleted User]> #5
Hmm, how is this intended? I feel like what I am doing is pretty standard; a dialog with elevation which is the Material Design recommended look for an alert dialog.
I believe this should be revisited, even if it's just by adding more padding.
pa...@google.com <pa...@google.com> #6
Your bug was about shadow being clipped. That was not an issue in the dialog but in the parent views clipping it as adding the padding fixed the issue.
[Deleted User] <[Deleted User]> #7
Well the parent views are all system views and not something I create myself so I still see this as a Compose bug
pa...@google.com <pa...@google.com> #8
The ComposeView has clipToPadding
set to false. At least that's what I see here in the source code. Any parent view / Activity above ComposeView is outside of control for Compose. Or to put it in other way, Compose can't just override it on the Activity and hope that was intended.
[Deleted User] <[Deleted User]> #9
The dialog is inside a window that is created by Compose itself. There are no other views created by me. Compose's Dialog
function creates this window so it's reasonable that it would also fix this issue for us.
pa...@google.com <pa...@google.com> #10
It's not clipped by the window but by the Activity
[Deleted User] <[Deleted User]> #11
I don't think so, the dialog is displayed in a separate window and is unaffected by the activity's window.
Description
Component used:
compose.ui
Version used:
1.0.1
Devices/Android versions reproduced on:
Pixel 5
I have a custom implementation of an alert dialog where I would like to add 24dp elevation. I add the elevation to the first child composable of
Dialog
but the elevation shadow is clipped at the bottom.It can be reproduced by this dialog: