Stop showing softkeyboard in WebView - android

Is there a way to prevent the softkeyboard to show up in a WebView? My app is attached to a scanner which simulates keyboard entry (that works so far), so the softkeyboard is only annoying when it occupies the screen.
The Nullkeyboard from the Playstore does the trick, but in certain cases I would like to enable the keyboard again.
If it helps, I can control the content of the webpage being shown. Would like to avoid programming a full input method.

In your manifest, on the activity, use android:windowSoftInputMode="stateAlwaysHidden" and the soft keyboard should never be displayed.

Related

.NET MAUI Entry keyboard does not hide

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

DateTime-local how to prevent keyboard from appearing in android webview

I currently have a cordova android application that uses the following html5 tag:
<input type="datetime-local"/>
On android this triggers the keyboard to show up. However, I want to disable the keyboard because it doesn't make sense because the widget itself is sufficient. You don't need the keyboard showing.
However, I can't figure out how to disable the keyboard from popping up.
Thanks,
D
Add "readonly" attribute to your input tag. It will prevent the triggering of keyboard.

Hide view when showing keyboard

I have two EditText views and one ImageView. My goal is to hide the ImageView when i am showing the keyboard (When the user have clicked on one of the EditText fields)
Then show the imageView again when the user have unfocused the EditText field or the keyboard is not visible anymore.
I have tried tons of different ways to do this. But nothing really works as intended. Do you guys have any idea how i could achieve this
Have you tried to detect if the keyboard is opened ? How do I Detect if Software Keyboard is Visible on Android Device?
Make debug and when is opened try to hide image . imageview.setvisibility (GONE)
if it does not work you can try to change layout
Make 2 layouts and switch visibility if the keyboard is open /closed
You can add a OnFocusChangeListener to the EditText,when you click the EditText,it will get focus,and then you can hide the ImageView.
<activity android:name="SearchResultsActivity"
android:windowSoftInputMode="adjustPan"/>
adjustPan:
The activity’s main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
regards! :)
You can do one thing, place UIView-> UIImageView -> UITextfield1-> UITextField2.Handle the UIImageView hiding state in textfield delegates which are Begin and End editing delegate methods

Android windowSoftInputMode issue

In my application, I am using <activity android:windowSoftInputMode="adjustResize"> for the keyboard pop up effect. When used "adjsutResize" I see there is a little flash of black screen before the Keyboard window pops up. I do not want to see any flash in the keyboard appearance. So I tried "stateVisible|adjustPan" in place of "adjsutResize" and I got rid of flash but now for each and everytime I navigate to a page the keyboard automatically pops up (even though there is no need of its pop up) and goes hidden.
Could anyone here let me know what kind of value/param for android:windowSoftInputMode will help me solving this issue.
I finally found it myself. Changing the value android:windowSoftInputMode to "adjustPan" gives the keyboard pop up the better view (transparent while popping up/down). I see no flash of the black screen before the keyboard pop up.

How to show the contents hidden by keyboard in the webview

My android application is a webview, and in first page there are 5 editboxes. When i enter some data in editbox the last editbox is hidden by keyboard. So i enclosed webview within a scrollview. But the scrolling is happening only on the first page but not on all the other pages. Is it possible to scroll screen up only if keyboard is hiding some text in webview?
Meanwhile i tried using the window attribute windowSoftInputMode="adjustResize" but still i am getting the same problem. Any Ideas on how to make this working?
-Regards,
Ron..
This could be the consequence of http://code.google.com/p/android/issues/detail?id=5497. Looks like adjustResize should work if you created your layout correctly, but it will not if your app is in fullscreen mode (i.e. the Android status bar is not displayed). If your app runs in fullscreen mode, try the 'normal' mode for a change and see if the webview adjusts its size correctly when the keyboard is displayed.

Categories

Resources