I've searched everywhere but I haven't found anything so far. I have a Fragment in which I force the display of the Keyboard (Numeric keypad to be more precise). However I'd like to know if there was a way to make this keyboard IMPOSSIBLE to dismiss (via the back button or whatsoever). I tried to deactivate the back button but no success.
Thanks for your answers.
Related
I have a very simple UI that has one entry control to enter phone number and a button. The entry control has a handler for removing border around it. When the entry control got focus, keyboard pops up. But when I try to tap outside the entry control such as on the screen empty area, the keyboard does not dismiss and the entry control does not lose focus. Also since the button is at the bottom of the screen, therefore, the soft keyboard hides it and there is no way to tap the button. The button can only be tapped if I press the Android device back button.
At present, I have not checked this behavior on an iOS device.
This was not a problem in Xamarin Forms though. I searched a lot on Internet and found that it is currently a bug in MAUI.
I tried to attach a tap gesture on the parent layout control and invoked platform-specific code to hide the keyboard but it seems the entry does not lose focus and in turn the tap gesture event is never called.
However, the entry control should lose focus automatically when I tap outside the entry control (such as on the screen) and the soft keyboard should automatically dismiss.
Please provide a workaround if there is any.
Known bug. Removing the focus sometimes helps. Sometimes you need to do Disable/Enable in sequence. (I go with the second).
If you want, you can read this for example:
https://github.com/dotnet/maui/issues/12002
(Most disturbing part, considering this is know bug for half year+)
We can leave the behavior how this is for now in NET7 and provide an
API in NET8 that lets users toggle this behavior on/off for iOS and
Android
I have an in app keyboard that tries to behave like a system keyboard. So far it pops up from the bottom using Bottom Sheet, which is great.
However, unlike a system keyboard, it does not push the entire layout up when you select an EditText that might otherwise get hidden. So far all the solutions I saw on StackOverFlow seem to be about Soft/System Keyboard not an in-app implementation like mine.
Here is my activity with 3 Edit Texts
This is what happens if I click on the last Edit Text. It gets covered by the keyboard in blue
This is how I want it to be. Everything getting pushed up.
How can I achieve this?
I know this answer has been asked multiple times but there has not been a legit answer that solves this issue. To this day, I cannot believe Google has not added a listener for the SoftKeyBoard. I am curious to know if anyone has a solution to listening to the backPress while the keyboard is visible? I am asking this because within the Google play store when the search is visible and you press back, it hides the search and the keyboard at the same time. I have recreated the search but cannot find a legit answer to closing a custom searchview and the keyboard at the same time. I have tried a lot of answers but none of them are working.
I am calling "adjustPan" within the Manifest MainActivity to prevent custom views from being shifted. "adjustPan" prevents the root layout from making room for the softKeyboard, rather the softKeyboard is above the root layout. So this eliminates any measure solutions, which have been the main solution to most of the answers.
android:windowSoftInputMode="adjustPan"
Here is the custom SearchView
It is likely that Google is not listening for the onBackPressed event - but rather configuration changes that involve the keyboard. If you want to hide something when the keyboard changes to "hidden" then monitor the configuration with onConfigurationChanged and it will have the same effect.
See this post: How to capture the "virtual keyboard show/hide" event in Android?
I looked for the question everywhere on the Internet but can't find the answer. What I found is to hide the whole button tray all together.
When the keyboard is down, the button is shown as in the picture.
But when the keyboard is showing the icon changes to -
My problem is to change the button (as in the second image), when my emoticons are showing. So, is there any way by which I can programatically change the button on an event and change it back on another event?
I'm afraid this is not possible yet. Perhaps this will be implemented in later versions of Android.
Not all devices have an onscreen navigation bar, a lot of devices still have hardware buttons.
Nevertheless, you'll might find this article interesting: http://arpitonline.com/blog/2014/07/27/improving-androids-navigationbar/
I have implemented a note-taking UI where a WebView accepts user input and below it is a row of buttons that toggle formatting inside of the WebView. The buttons sit on the bottom of the layout, so when the soft-keyboard pops up when the WebView has focus the buttons sit just above the keyboard.
This is working great, but my problem is that whenever one of the buttons is pressed the soft-keyboard closes. I want to leave the soft-keyboard as it is whenever a button is pressed. So if it is closed, a button press won't open it, and if it is open then a button press won't close it.
I found the Wordpress Android source code, and the layout is extremely similar and it has the exact button-keyboard interaction I want.
The relevant sources on GitHub are here Activity Code and here Layout XML
I can't figure out how they do it though. They don't call the InputMethodManager, which I am trying to avoid if possible since it can cause jumpy behavior where the keyboard has to re-open itself whenever a button is pressed. The one similar question I found had answers that essentially said to do exactly that, or create a useless view to get the focus to prevent the keyboard from closing. Neither seem very efficient.