Xaml Xamarin表单-一页上有多个视图
因此,我需要实现,但我似乎找不到一种方法,使这成为可能的跨平台。我可以看到,在IOS上,您可以通过向页面添加多个ViewController来实现这一点,但在xamarin表单中是否可以实现这一点 如果你有这方面的经验,请告诉我Xaml Xamarin表单-一页上有多个视图,xaml,xamarin.forms,xamarin.android,xamarin.ios,Xaml,Xamarin.forms,Xamarin.android,Xamarin.ios,因此,我需要实现,但我似乎找不到一种方法,使这成为可能的跨平台。我可以看到,在IOS上,您可以通过向页面添加多个ViewController来实现这一点,但在xamarin表单中是否可以实现这一点 如果你有这方面的经验,请告诉我 提前谢谢 有许多解决方案可以实现它。例如,您可以使用AbsoluteLayout创建滑动视图 在ContentPage中 您可以参考 <AbsoluteLayout BackgroundColor="White" AbsoluteLayout.
提前谢谢 有许多解决方案可以实现它。例如,您可以使用AbsoluteLayout创建滑动视图 在ContentPage中
您可以参考
<AbsoluteLayout BackgroundColor="White" AbsoluteLayout.LayoutBounds="0,1,1,1">
<!-- -->
<Button Clicked="Button_Clicked" Text="Test" AbsoluteLayout.LayoutBounds="0.5,0.3,0.2,0.05" AbsoluteLayout.LayoutFlags="All" />
<StackLayout x:Name="bottomBar" BackgroundColor="Olive" AbsoluteLayout.LayoutBounds="0.5,1.0,1.0,0.04" AbsoluteLayout.LayoutFlags="All">
<!-- put the content of swipe here -->
</StackLayout>
</AbsoluteLayout>
bool isShow;
const double layoutPropHeightMax = 0.45;
const double layoutPropHeightMin = 0.06;
//you could set the height here as you want
private void Button_Clicked(object sender, EventArgs e)
{
if(!isShow)
{
//show the keyboard
Device.BeginInvokeOnMainThread(async () =>
{
var height = layoutPropHeightMin;
while (height < layoutPropHeightMax)
{
await Task.Delay(1);
height += 0.04;
AbsoluteLayout.SetLayoutBounds(bottomBar, new Rectangle(0.5, 1.0,1.0, height));
}
});
}
else
{
// hide the keyboard
Device.BeginInvokeOnMainThread(async () =>
{
var height = layoutPropHeightMax;
while (height > layoutPropHeightMin)
{
await Task.Delay(1);
height -= 0.04;
AbsoluteLayout.SetLayoutBounds(bottomBar, new Rectangle(0.5, 1.0, 1.0, height));
}
});
}
isShow = !isShow;
}