Hello!
I recently implemented a PullToReload
in my app and using the ScrollView
for its operation has created layout issues.
The original layout looked similar to the following, I have a ClientPanel
(to take care of status and bottom bars) with a DockPanel
inside. The DockPanel
has 3 elements: the first docked “Top”, the next docked “Bottom” and the third is expected to take up all remaining space (in the middle). Similar to the following:
<App>
<ClientPanel ux:Name="screen">
<DockPanel>
<Rectangle ux:Name="rec1" Dock="Top" Color="#aaa">
<Text Value="I'm at the top!" Alignment="Center" FontSize="32"/>
</Rectangle>
<Rectangle ux:Name="rec2" Dock="Bottom" Color="#aaa">
<Text Value="I'm at the bottom!" Alignment="Center" FontSize="32"/>
</Rectangle>
<Rectangle ux:Name="fill" Color="#aaf">
<Text Value="I'm the fill!" Alignment="Center" FontSize="32"/>
</Rectangle>
</DockPanel>
</ClientPanel>
</App>
Adding the ScrollView
collapses the “fill” section and the only way I’ve found to try and get it back is to use height() expressions as follows:
<App>
<ClientPanel ux:Name="screen">
<ScrollView SnapMaxTransform="false" SnapMinTransform="false">
<DockPanel>
<Rectangle ux:Name="rec1" Dock="Top" Color="#aaa">
<Text Value="I'm at the top!" Alignment="Center" FontSize="32"/>
</Rectangle>
<Rectangle ux:Name="rec2" Dock="Bottom" Color="#aaa">
<Text Value="I'm at the bottom!" Alignment="Center" FontSize="32"/>
</Rectangle>
<Rectangle ux:Name="fill" Color="#aaf" Height="height(screen)-height(rec1)-height(rec2)-72">
<Text Value="I'm the fill!" Alignment="Center" FontSize="32"/>
</Rectangle>
</DockPanel>
</ScrollView>
</ClientPanel>
</App>
This seems a little hacky to me (especially the magic number [72] to account for the status/bottom bars). And, while it looks ok using the Android Preview App (on PixelXL with Android 8.1.0), it doesn’t look great in the Fuse Studio preview (all the white space at the bottom) Is there a better or recommended way to handle this situation?
Info:
-
Fuse version 1.5.0 (build 15046)
-
Uno version 1.4.3 (build 6115) Windows 10 x64 83d8656
Product information
-
Product.Commit 83d8656035e71a42151ce35b76e3b59cf7725e08
-
Product.Version 1.4.3.6115
Runtime environment
-
Environment.OSVersion Microsoft Windows NT 6.2.9200.0
-
Environment.Version 4.0.30319.42000