Android Platform Features
Developing Xamarin.Forms applications for Android requires Visual Studio. The supported platforms page contains more information about the pre-requisites.
Platform-specifics
Platform-specifics allow you to consume functionality that's only available on a specific platform, without implementing custom renderers or effects.
The following platform-specific functionality is provided for Xamarin.Forms views, pages, and layouts on Android:
- Controlling the Z-order of visual elements to determine drawing order. For more information, see VisualElement Elevation on Android.
- Disabling legacy color mode on a supported
VisualElement
. For more information, see VisualElement Legacy Color Mode on Android.
The following platform-specific functionality is provided for Xamarin.Forms views on Android:
- Using the default padding and shadow values of Android buttons. For more information, see Button Padding and Shadows on Android.
- Setting the input method editor options for the soft keyboard for an
Entry
. For more information, see Entry Input Method Editor Options on Android. - Enabling a drop shadow on a
ImageButton
. For more information, see ImageButton Drop Shadows on Android. - Enabling fast scrolling in a
ListView
. For more information, see ListView Fast Scrolling on Android. - Controlling the transition that's used when opening a
SwipeView
. For more information, see SwipeView Swipe Transition Mode. - Controlling whether a
WebView
can display mixed content. For more information, see WebView Mixed Content on Android. - Enabling zoom on a
WebView
. For more information, see WebView Zoom on Android.
The following platform-specific functionality is provided for Xamarin.Forms cells on Android:
- Enabling
ViewCell
context actions legacy mode, so that the context actions menu is not updated when the selected item in aListView
changes. For more information, see ViewCell Context Actions on Android.
The following platform-specific functionality is provided for Xamarin.Forms pages on Android:
- Setting the height of the navigation bar on a
NavigationPage
. For more information, see NavigationPage Bar Height on Android. - Disabling transition animations when navigating through pages in a
TabbedPage
. For more information, see TabbedPage Page Transition Animations on Android. - Enabling swiping between pages in a
TabbedPage
. For more information, see TabbedPage Page Swiping on Android. - Setting the toolbar placement and color on a
TabbedPage
. For more information, see TabbedPage Toolbar Placement and Color on Android.
The following platform-specific functionality is provided for the Xamarin.Forms Application
class on Android:
- Setting the operating mode of a soft keyboard. For more information, see Soft Keyboard Input Mode on Android.
- Disabling the
Disappearing
andAppearing
page lifecycle events on pause and resume respectively, for applications that use AppCompat. For more information, see Page Lifecycle Events on Android.
Platform support
Originally, the default Xamarin.Forms Android project used an older style of control rendering that was common prior to Android 5.0. Applications built using the template have FormsApplicationActivity
as the base class of their main activity.
Material design via AppCompat
Xamarin.Forms Android projects now use FormsAppCompatActivity
as the base class of their main activity. This class uses AppCompat features provided by Android to implement Material Design themes.
Here is the Todo sample with the default FormsApplicationActivity
:
And this is the same code after upgrading the project to use FormsAppCompatActivity
(and adding the additional theme information):
Note
When using FormsAppCompatActivity
, the base classes for some Android custom renderers will be different.
AndroidX Migration
AndroidX replaces the Android Support Library. To learn about AndroidX and how to migrate a Xamarin.Forms app to use AndroidX libraries, see AndroidX migration in Xamarin.Forms.