Building the CustomImageRenderer for Android
Add a new folder into the Renderers
folder called CusotmImage
, add a new file called CustomImageRenderer.cs
, and implement the following:
public class CustomImageRenderer : ViewRenderer<CustomImage, ImageView> { #region Private Properties private readonly string _tag; private ImageView _imageView; private CustomImage _customImage; private ILogger _log; private Bitmap _bitmap; #endregion #region Constructors public CustomImageRenderer() { _log = IoC.Resolve<ILogger> (); _tag = string.Format ("{0} ", GetType ()); } #endregion
We are going to use an ImageView
as the native control. We also have a local CustomImage
, which will reference the element we are rendering on. We also have a local Bitmap
, which ...
Get Xamarin Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.