我有标签标题标题、列表视图和按钮。所有控件都需要在页面中滚动。但是 Listview 在放置在滚动视图中时会占用更多空间。任何人都可以面对这样的问题吗?
2 回答
0
Listview 已经具有滚动行为。为什么使用视图在另一个滚动视图中具有滚动属性..?如果您的页面中有多个列表视图,则可以使用 Scrollview。如果您仍想使用浴缸视图,请尝试设置 listview HasUnevenRows="True"的此属性
于 2019-05-14T09:42:21.917 回答
0
如前所述,在 ScrollView 中放置 ListView 通常是一个坏主意,如此处所述。
话虽如此,我复制了这个问题并通过将 RowHeight 添加到 ListView 来让页面停止拉伸。
<ScrollView BackgroundColor="Black">
<StackLayout BackgroundColor="LightBlue">
<Label Text="BEFORE"/>
<ListView BackgroundColor="LightGray"
RowHeight="40">
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>mono</x:String>
<x:String>monodroid</x:String>
<x:String>monotouch</x:String>
<x:String>monorail</x:String>
<x:String>monodevelop</x:String>
<x:String>monotone</x:String>
<x:String>monopoly</x:String>
<x:String>monomodal</x:String>
<x:String>mononucleosis</x:String>
</x:Array>
</ListView.ItemsSource>
</ListView>
<Label Text="AFTER"/>
</StackLayout>
</ScrollView>
于 2019-05-14T19:50:21.193 回答