locked
Same UI across platform using Xamarin.Forms RRS feed

  • Question

  • User115325 posted

    I am currently developing a mobile app using Xamarin.Forms for Android and IOS. I need to share the UI code without rendering to specific platform. The UI must be same across the platform. Is it possible with Xamarin.Forms Please help me to sort out this issue.

    Tuesday, April 21, 2015 6:10 AM

Answers

  • User181 posted

    The answer is simple: if you don't want a native look and feel then you should not use Xamarin.Forms. It's designed to give you a native look and feel, and any divergence from that requires (by design) native renderer code, which means less code reuse across platforms. At the outset we can say for certain that Xamarin.Forms can't do what you want because your requirements (no native look and feel and no platform-specific code) are contradictory when using Xamarin.Forms. Even if you relaxed the "no platform-specific code" requirement, if you find yourself writing custom renderers for nearly everything in the app then you're doing it wrong. That's not what Xamarin.Forms is for, and you're going to end up with something that costs more than just going native with Xamarin.Android and Xamarin.iOS directly.

    Xamarin.Forms is just not the tool for your requirements.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, April 21, 2015 3:27 PM

All replies

  • User62190 posted

    this is what XF is for.

    Tuesday, April 21, 2015 6:54 AM
  • User35206 posted

    This might not be what @SimonC is looking for :wink:

    For some definition of "same" the UI on each platform is different, because it looks like a native app on each and every one.

    It's a confusing question since if one is developing with XF it's already obvious what it is and what it isn't for :smile:

    Tuesday, April 21, 2015 7:12 AM
  • User115325 posted

    @DrazenDotlic My point is I want to use the same UI across the platform but the app must not look like native app. I want my custom design to be displayed in all the platforms. For Ex. The TabbedPage Layout displays the tab at the top in android and at the bottom on IOS. But I want it to be on the top for all platforms.

    Tuesday, April 21, 2015 7:33 AM
  • User73562 posted

    As @DrazenDotlic said, Xamarin Forms gives a native rendering on each platform.

    For instance, on this page : http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/pop-ups/

    The rendering of the DisplayAlert is pretty similar between iOS, Android and WinPhone (Except for the color).

    On the other hand, the rendering of the ActionSheet (http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/pop-ups/#DisplayActionSheet) is a bit more different on each platform.

    If you want a look alike UI on each platform, you'll have to use Custom Renderers or components (this one for instance gives an iOS-like action sheet : http://components.xamarin.com/view/XamActionSheet).

    In short, you'll have the same UI every time the native UI for each platform is the same. Which is almost never.

    Tuesday, April 21, 2015 7:41 AM
  • User3466 posted

    @SimonC you can create an application that has its own interface across all three platforms but it may be more work than it is worth. It really depends on the complexity of the UI for your application. If it is a simplistic UI, that consists of one or a few pages with simple controls, then it will be totally possible. If you have a complex navigation scheme, then no so much.

    Here are some things to consider:

    1. The application may not function that way other applications on the same platform does. This could lead to user confusion.

    2. You will not be able to use many of the Page layouts, with the exception of ContentPage, because they all implement platform-centric presentations.

    3. This means you will have create your own application style that will be exactly the same on all platforms. Again, for simple pages, this is not a problem.

    4. You will probably have to create custom renderers to reproduce some of the more complex features such as navigation (tabbed page for instance, since you mentioned that).

    I went down that path with one of my applications and after spending a couple of weeks, decided it was just not worth the effort. Your journey may be different.

    Good luck.

    Mitch

    Tuesday, April 21, 2015 12:23 PM
  • User76049 posted

    @SimonC

    It might be easier achieving that with an HTML5 framework and a Hybrid app approach, the downside is the numerous javascript frameworks you have to use, naff debugging experience, not using C# etc. We went with Hybrid apps 1st of all and you can make them run over iOS and Android and they look pretty much the same, they don't feel native though and really you are just running in the sandbox of the phones native browser. There's lots of gotchas and getting at native handset features can be a pain (your at the mercy of Cordova). Different tools to choose depending on your requirements. Having tried both approaches and despite some forms niggles I wouldn't go back to Hybrid.

    Tuesday, April 21, 2015 1:57 PM
  • User181 posted

    The answer is simple: if you don't want a native look and feel then you should not use Xamarin.Forms. It's designed to give you a native look and feel, and any divergence from that requires (by design) native renderer code, which means less code reuse across platforms. At the outset we can say for certain that Xamarin.Forms can't do what you want because your requirements (no native look and feel and no platform-specific code) are contradictory when using Xamarin.Forms. Even if you relaxed the "no platform-specific code" requirement, if you find yourself writing custom renderers for nearly everything in the app then you're doing it wrong. That's not what Xamarin.Forms is for, and you're going to end up with something that costs more than just going native with Xamarin.Android and Xamarin.iOS directly.

    Xamarin.Forms is just not the tool for your requirements.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Tuesday, April 21, 2015 3:27 PM
  • User249470 posted

    Hello

    I found one useful link To develop Same UI across platform using Xamarin.Forms, Sharing with all. Hope it may useful to you also

    xamarin look and feel same for all platform

    Microsoft Mobile Apps with Xamarin.Forms

    Saturday, September 9, 2017 9:58 AM