From cd1cf19fcad6ae049e90fdc5819c4f7c6adb57f6 Mon Sep 17 00:00:00 2001 From: Pavel Yakovlev Date: Tue, 12 Feb 2019 16:39:03 +0300 Subject: [PATCH] [Android] fixes TabStop on Stepper Control (#5000) fixes #4956 --- Xamarin.Forms.Platform.Android/Renderers/StepperRenderer.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Xamarin.Forms.Platform.Android/Renderers/StepperRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/StepperRenderer.cs index 1604d0d..353b2c8 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/StepperRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/StepperRenderer.cs @@ -27,7 +27,12 @@ namespace Xamarin.Forms.Platform.Android protected override LinearLayout CreateNativeControl() { - return new LinearLayout(Context) { Orientation = Orientation.Horizontal }; + return new LinearLayout(Context) + { + Orientation = Orientation.Horizontal, + Focusable = true, + DescendantFocusability = DescendantFocusability.AfterDescendants + }; } protected override void OnElementChanged(ElementChangedEventArgs e) @@ -36,16 +41,18 @@ namespace Xamarin.Forms.Platform.Android if (e.OldElement == null) { - _downButton = new AButton(Context) { Text = "-", Gravity = GravityFlags.Center, Tag = this }; + _downButton = new AButton(Context) { Text = "-", Gravity = GravityFlags.Center, Tag = this, Focusable = true }; _downButton.SetHeight((int)Context.ToPixels(10.0)); _downButton.SetOnClickListener(StepperListener.Instance); - _upButton = new AButton(Context) { Text = "+", Tag = this }; + _upButton = new AButton(Context) { Text = "+", Tag = this, Focusable = true }; _upButton.SetOnClickListener(StepperListener.Instance); _upButton.SetHeight((int)Context.ToPixels(10.0)); + _downButton.NextFocusForwardId = _upButton.Id = Platform.GenerateViewId(); + var layout = CreateNativeControl(); layout.AddView(_downButton); -- 2.7.4