2017-06-29 75 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