Is there a way for a @Preview in the compose previ...
# compose
s
Is there a way for a @Preview in the compose preview section of the IDE to expand vertically as much as there is content, without being limited to how big the default preview screen is? I’ve added
@Preview(device = "spec:width=1080px,height=3340px,dpi=440")
in an effort to make it take 3340px vertically, but optimally I’d want it to expand as much as it needs to without me having to hard code something there. If I don’t put anything it gets cut off at a normal “Device” height. My use case is that I have a long-ish screen which takes about 1.5-2 screens worth of content vertically, and I want my preview to show all of it, if possible.
🚫 1
c
Not at the moment. There are some hard-coded limits to Preview size due to the amount of memory a large one can take. I would file a feature request though.
s
Yeah I can make a feature request. What I ended up doing for now is make it 10_000 pixels high manually, and it did work, but it was getting very blurry, and when I copied the image to show it to someone it also was quite blurry. The most evident part of it was that some icon which had a vector image was looking really funky. Is that expected?
Actually, it's right here https://github.com/HedvigInsurance/android/pull/1591 so you can better see what I mean about blurriness and some vector icons looking funky.
c
Yes it’s expected for render quality to go way down on large previews due to memory usage. We don’t have a way to set preview quality on individual previews but might consider it in the future
s
Awesome, thanks for confirming! Can’t create issues on
Android Public Tracker > App Development > Android Studio > Design Tools > Compose Preview
directly “You do not have permission to create issues in this component.” So made it at
Android Public Tracker > App Development > Android Studio
which is the first accessible by the public there. Allow composable previews to grow vertically as the content they contain grows with them. https://issuetracker.google.com/issues/283366651 Allow to specify higher quality requirements for previews that grow a lot in size. https://issuetracker.google.com/issues/283312420
c
Thanks for filing! Looks like they were properly triaged
161 Views