2017-06-29 97 views
0

我知道,这个问题以前有人问,但大部分都是从一年多以前,我想知道这个问题是否仍然存在。Xamarin表单自定义导航转换

不Xamarin形式仍然提供自定义导航的页面转换不支持?

我知道,你可以让动画以及在本机应用程序,但它从我的研究似乎Xamarin形式要求要么做一个简单的自定义页面过渡定制渲染器或包。这有没有改变或仍然是常态?希望他们添加某种形式的支持,因为这些线程被问到。

感谢

+0

AFAIK直到最近这不被xamarin形式支持。亚历山大尼库林写了一个可以做到这一点的组件, https://github.com/AlexandrNikulin/AnimationNavigationPage –

回答

0

Xamarin.Forms没有做到这一点的能力,但有一个变通方法。

如果你推或爆裂页面时禁用动画过渡,你可以做之前你的自定义动画/过渡后。

像这样:

// First animate the opacity of the current page 
new Animation(opacity => page.Opacity = opacity/100, 100, 0) 
    .Commit(this, "PageExitAnimation", 1, 350, Easing.CubicInOut, (d, b) => 
    { 
     var otherPage = new OtherPage() { Opacity = 0 }; // Create the page with 0 opacity to animate later 
     NavigationPage.Navigation.PushAsync(otherPage, false); // Push the new page, as the current page is already with 0 opacity, without animation 
     otherPage.FadeTo(1, 350, Easing.CubicInOut); // Animate the fade of the next page 
    } 

你可以把这个概念做任何形式的动画,只是不是修改不透明度,修改TranslationY,TranslationX等,如果你想有一个复杂的动画,你可以修改一个以上在同一时间太多,只是把你的时间来学习Xamarin.Forms动画和你去好:)

希望帮助! :D