Xamarin.forms Xamarin Forms 4.1:ScrollView滚动条覆盖android设备9.0中的标题视图
在Xamarin Forms 4.1中,当滚动时,scrollview内容覆盖/溢出headerview,scrollview内容未完全显示 使用IsClippedToBounds尝试为true。 已创建scrollviewrenderer,OnDraw()->将剪辑设置为绑定属性。但是没有起作用 示例:这是XAML设计Xamarin.forms Xamarin Forms 4.1:ScrollView滚动条覆盖android设备9.0中的标题视图,xamarin.forms,scroll,scrollview,Xamarin.forms,Scroll,Scrollview,在Xamarin Forms 4.1中,当滚动时,scrollview内容覆盖/溢出headerview,scrollview内容未完全显示 使用IsClippedToBounds尝试为true。 已创建scrollviewrenderer,OnDraw()->将剪辑设置为绑定属性。但是没有起作用 示例:这是XAML设计 <Stacklayout> <HeaderView/> <ScrollView IsClippedToBounds="t
<Stacklayout>
<HeaderView/>
<ScrollView IsClippedToBounds="true">
<Stacklayout>
<label text="1"/>
........
........
<label text="100"/>
</Stacklayout>
</ScrollView>
</Stacklayout>
........
........
如果希望标题始终可见,而不是将内容放在标题中,则最好先将标题内容放在列表视图下方。因此,标题保持不变,listview滚动 我制作了一个自定义控件作为您描述中的headerview。在Xamarin.forms 4.1上进行测试,效果良好
MyCustomConrol:
<StackLayout Orientation="Horizontal" BackgroundColor="Aqua">
<Label x:Name="Title_label" Text="Title" TextColor="Black" FontSize="25" HorizontalOptions="StartAndExpand" Margin="8,0,4,0"/>
<Button x:Name="btnHello" Text="Hello" HorizontalOptions="EndAndExpand" Margin="4,0,8,0"/>
</StackLayout>
MainPage.xaml
<StackLayout>
<local:MyCustomControl></local:MyCustomControl>
<!--<HeaderView/>-->
<ScrollView IsClippedToBounds="true">
<StackLayout>
<Label Text="1"/>
<Label Text="2"/>
<Label Text="3"/>
……………
…………………
</StackLayout>
</ScrollView>
……………
…………………
结果:
<StackLayout Orientation="Horizontal" BackgroundColor="Aqua">
<Label x:Name="Title_label" Text="Title" TextColor="Black" FontSize="25" HorizontalOptions="StartAndExpand" Margin="8,0,4,0"/>
<Button x:Name="btnHello" Text="Hello" HorizontalOptions="EndAndExpand" Margin="4,0,8,0"/>
</StackLayout>
您可以从GitHub的ScrollView/XamarinDemo文件夹下载以供参考。
请帮帮我!!提前感谢HeaderView包含的内容?您的问题有点含糊。您能说得具体一点吗?它使用的是Xamarin Forms 3.1版本,而不是4.1HeaderView内容视图保留标题标签和按钮感谢输入。但是我们使用的是scrollView而不是ListView。