【发布时间】:2017-08-31 22:16:49
【问题描述】:
我有一个 StackLayout,其中包含一个 TableView、一个网格和几个标签。
我的问题是 StackLayout 强制所有元素覆盖 100% 的屏幕高度,并且在我的 TableView 上生成垂直滚动:
我想删除控件内的垂直滚动,而是为整个视图设置一个“全局”滚动。
这是该视图的 XAML 代码:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage Title="Create Account"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AudioBitts"
x:Class="AudioBitts.SignUpPage">
<StackLayout>
<TableView x:Name="socialListView">
<TableRoot>
<TableSection Title="Social sign up">
<ImageCell ImageSource="{local:EmbeddedImage ResourceId=AudioBitts.Images.Icons.socialFacebook@3x.png}" Text="Sign up with Facebook" />
<ImageCell ImageSource="{local:EmbeddedImage ResourceId=AudioBitts.Images.Icons.socialTwitter@3x.png}" Text="Sign up with Twitter" />
<ImageCell ImageSource="{local:EmbeddedImage ResourceId=AudioBitts.Images.Icons.socialGoogle@3x.png}" Text="Sign up with Google+" />
</TableSection>
<TableSection Title="Email sign up">
<EntryCell Label="Email" Placeholder="Your email"/>
<EntryCell Label="Password" Placeholder="Min 6 characters"/>
</TableSection>
</TableRoot>
</TableView>
<Grid Padding="20" HorizontalOptions="Center" VerticalOptions="Center">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Text="Already have an account?" />
<Label x:Name="onSignIn" Grid.Row="0" Grid.Column="1" Text="Sign In" TextColor="#ff0030" />
</Grid>
<Label Text="AudioBitts Inc." HorizontalOptions="Center" />
<Label Text="Terms of Use and Privacy Policy" HorizontalOptions="Center" />
</StackLayout>
</ContentPage>
【问题讨论】:
-
首先为您的桌子指定高度
-
所以如果我添加一个新的社交网络选项,我需要更新那个高度吗?有没有更动态的方式?
标签: xaml user-interface xamarin.forms tableview