Move focus on the next control: Android version

Some days ago I have published a sample Xamarin.Forms control to simply move focus on others controls of the page. I’ve presented just the iOS version but now it’s the time to see also the Android implementation.

TLEntryRenderer in Android

The control is so simple that in just few lines of codes we’ll be able to realize the Android version. Here the renderer code:

[assembly: ExportRenderer(typeof(TLEntry), typeof(TLEntryRenderer))]
namespace TitiusLabs.Forms.Droid.Controls
{
	public class TLEntryRenderer : EntryRenderer
	{
		protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
		{
			base.OnElementChanged(e);

			var element = e.NewElement as TLEntry;
			if (element.ReturnButton == ReturnButtonType.Next)
			{
				Control.ImeOptions = Android.Views.InputMethods.ImeAction.Next;
				Control.EditorAction += (sender, args) =>
				{
					element.OnNext();
				};
			}
		}
	}
}

the code is available, as always, on github.

This is the final result:

movefocus_xamarinforms_android

Nice and simple!

Found a problem? Edit this post