Reputation: 895
On making a new project solution in XAMRIN
, there are 3 projects were created
1. ProjectName.Portable
2. ProjectName.Android
3. ProjectName.IOS
Can I add widgets in the Android project and on running the app, will that added widgets added in Android be showing in the IOS and WINDOWS apps? The purpose is only that I am familiar with Android development but in Portable
project, the development is a bit different than Android.
Upvotes: 0
Views: 89
Reputation: 24460
Short answer, no.
Longer answer:
Depending on what project type you choose you define your views differently.
If you choose Xamarin.Forms, typically you would define all your views in the Portable project and changes will be reflected in both your Android and iOS project.
If you choose a classic Xamarin app, you need to define views per platform. So you would define Views, Activities and Fragments on Android. On iOS you would similarly define Views and ViewControllers.
In short terms, Xamarin apps are native apps, written in C#. Hence, unless you add abstraction, you won't automatically get write once run anywhere functionality.
Upvotes: 2
Reputation: 694
You should not reference code from different platforms. Instead, reference portable project from every platform. In portable project place some cross-platform code that is independent from where it runs. And place platform-dependent code in platform projects.
Use Xamarin.Forms in your portable project to build cross-platform UI. If you need to, use Xamarin.Android to operate Android-specific UI elements with Renderers. Do last step for every platform you need.
Upvotes: 1