Quantcast
Channel: Prevent show SoftKeyboard on entry focused .NET MAUI - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Prevent show SoftKeyboard on entry focused .NET MAUI

$
0
0

I need to hide Softkeyboard when an entry is focused on Net MAUI on .net7 in Android in order to input data from a barcode Scanner.

So far I tried to disable/enable entry when focused, but the behavior is not correct.

I also tried a KeyBoardHelper that I found with the same behavior (not showing cursor or when entry is focused I changed backgroundcolor and with this helper does not change).

public static partial class KeyboardHelper    {        public static void HideKeyboard()        {            var context = Platform.AppContext;            var inputMethodManager = context.GetSystemService(Context.InputMethodService) as InputMethodManager;            if (inputMethodManager != null)            {                var activity = Platform.CurrentActivity;                var token = activity.CurrentFocus?.WindowToken;                inputMethodManager.HideSoftInputFromWindow(token, HideSoftInputFlags.None);                activity.Window.DecorView.ClearFocus();            }        }    }

Is there other way to prevent to show keyboard when an entry is focused?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images