我正在开发一个Xamarin.Forms PCL项目。
我正在撰写一个显示帖子的页面,该帖子的评论以及撰写评论的条目。
我的XAML
<ContentPage.Content>
<StackLayout>
<ScrollView>
<StackLayout>
<StackLayout>
<local:PostListView x:Name="Post" ItemTemplate=...>
</local:PostListView>
</StackLayout>
<StackLayout>
<Label x:Name="CommentHeader" FontSize="15" FontAttributes="Bold" HorizontalOptions="CenterAndExpand"/>
<ListView x:Name="CommentsList" HasUnevenRows="True" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<local:PostViewCell>
...
</local:PostViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ScrollView>
<StackLayout>
<StackLayout x:Name="CommentBox" Padding="10, 5, 10, 10">
<Entry x:Name="CommentEntry" Placeholder="Comment" BackgroundColor="GhostWhite" Focused="CommentEntry_Focused" Unfocused="CommentEntry_Unfocused" TextChanged="CommentEntry_TextChanged"/>
</StackLayout>
</StackLayout>
</StackLayout>
</ContentPage.Content>
第一个自定义ListView一次只显示一个帖子,但我习惯使用,因此我可以使用ItemTemplate功能。
我的问题是:
整个页面应该一起滚动(留下评论条目),但是第一个ListView覆盖了整个屏幕,只有在向下滚动时才显示注释ListView,它只需要大约1/5的页面,其余的是空白空间。
评论条目应该位于页面底部,但在聚焦时显示在键盘顶部,而是被键盘覆盖。