News
AndroidX Support Highlights New Xamarin.Forms 4.5 Release
Support for AndroidX, or next-gen Android Support Libraries, highlights the new release of Xamarin.Forms 4.5, the latest edition of Microsoft's .NET-based cross-platform UI toolkit for creating mobile applications running on Windows, Mac or Linux.
AndroidX Support
AndroidX stands for Android extension libraries, replacing the old Android Support Library that's no longer maintained. One practical aspect of AndroidX is making package names more clear. Or, as Google said last December about AndroidX:
- All packages in AndroidX live in a consistent namespace starting with the string androidx. The Support Library packages have been mapped into corresponding androidx.* packages. For a full mapping of all the old classes and build artifacts to the new ones, see the Package Refactoring page.
- Unlike the Support Library, androidx packages are separately maintained and updated. The androidx packages use strict Semantic Versioning, starting with version 1.0.0. You can update AndroidX libraries in your project independently.
- Version 28.0.0 is the last release of the Support Library. There will be no more android.support library releases. All new feature development will be in the androidx namespace.
Microsoft introduced AndroidX to Xamarin last year and earlier this month announced that AndroidX NuGet packages were stable.
Now today (Feb. 26) came news of default AndroidX support. "Now in Xamarin.Forms 4.5, use AndroidX by default just like Xamarin.Essentials version 1.5," said program manager David Ortinau in a blog post. "Delivering both cross-platform UI and platform services together. This requires no change to your code. If you notice any undesirable side-effects, please open an issue here."
Ortinau pointed to a separate blog post for migration guidance.
Other Highlights of Xamarin.Forms 4.5
Other highlights of Xamarin.Forms 4.5 include:
- VisualStateManager Target: "Until now, VisualStateManager has focused directly on the controls to which it is specifically applied. Adding Target to setters provides flexibility to change properties on any control within the visual tree; not just the control the VisualStateManager is attached to." More about this feature is available in a blog post, documentation and sample demos.
- Shell Modals: "Whether you are using tabs or a fly-out menu, Shell is the easiest way to get started with your cross-platform mobile application. A favorite aspect of using Shell is the URI based navigation service that is omnipresent. Now, the ability to display modal pages uses that very same URI method. By using the new Shell.PresentationModel attached property, can describe your intention for any page you want to present as a modal." See more here.
- PlatformSpecifics: "Thanks to Xamarin.Android, Xamarin.iOS, and Windows, a major advantage to using Xamarin.Forms is easy access to native platform UI. When possible, we bring common concepts into alignment and provide a cross-platform API. When things don't align, it sometimes makes more sense to provide something specific to the platform it applies to. In 4.5 we have a handful of those." These include four iOS-specific offerings -- including ones for picking dates and times -- and one Windows-specific Image location item. See more here.
Preview Features
While the above describe the main features of the new release as highlighted by Ortinau, he also provided a peek into future enhancements, detailing five features now in preview:
- CarouselView and IndicatorView: "We are continuing to work through feedback on
CarouselView
and IndicatorView
. As we do, the list gets shorter!" See more on CarouselView and IndicatorView.
- SwipeView: "Reveal contextual content when swiping in specific directions by wrapping any control with a SwipeView. The community has been very inspired by this control and have been using it in many different ways! We are working hard to stabilize this control by implementing many requested improvements." See more here.
- StateTriggers: "We have added state triggers in support of new dual-screen experiences, the new MediaElement, and generally to be more useful." These include Adaptive, Compare, Device and Orientation triggers. See more here.
- MediaElement: "Brand new in this release is
MediaElement
, a base control for playback of audio and video. See this control featured in our XamarinTV sample app, which was featured during the Microsoft Surface Dual-Screen live event from Redmond." See more here.
All of the above and more, including information on more than 50 other fixes, is presented in more detail in the release notes.
About the Author
David Ramel is an editor and writer at Converge 360.