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.
Related
I have created my own onscreenkeyboard. When i focus to textfield it will automatically popup the keyboard. If i add Gdx.input.setOnscreenKeyboardVisible(false), to the focusing method the keyboard will show up anyway for a second. Has anyone got a workaround for this?
Thanks!
According to the documentation, you should be able to do setOnScreenKeyboard() and supply your custom OnScreenKeyboard implementation. My guess is that it is trying to call show() on both your keyboard and the default keyboard. Setting the keyboard to use will prevent the default from showing up.
<input type="text" class="numberonly">
I want to change the type of this html input from text to number on focus.
$(".numberonly").focus(function(){
$(this).attr("type","number");
});
this jquery works fine but when the webpage is embedded inside the android webview, the android keyboard wont show up on focus. Does jquery .focus prevents default behavior or what? Should I trigger the focus programmaticaly?
e.g.
The second click in the input, brings up the keyboard.
The android default browser has no problem. But the webview inside the android app fails to load keyboard.
I have an application where I needed to create a custom keyboard since barcode scanners are classified as hardware keyboards and hardware keyboards disable soft keyboards. The issue is that when no scanner is connected, the built in soft keyboard will be displayed when it's not needed. I have a button to show the custom keyboard which will also hide the default keyboard using
((InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(advText.getWindowToken(), 0);
(advText is an extended version of EditText)
I have tried placing that line of code in the onFocusChanged method of the EditText but nothing happens. If I use setInputType(InputType.TYPE_NULL); the android keyboard never shows, but the EditText doesn't display a cursor or anything that is typed from the custom keyboard (but I do know that keys are being stored since my "done" key sends the text from the EditText elsewhere just fine).
I'm fine with disabling the android keyboard completely for this app, just as long as the EditTexts show cursors and custom keyboard is only shown when using the button.
I have looked at these answers, but no luck finding a solution.
Close/hide the Android Soft Keyboard
How to show soft-keyboard when edittext is focused
How to hide Android soft keyboard on EditText
Edit:
My current solution is to run the hide method inside of the EditText's onCheckIsTextEditor since that seems to run after onFocusChanged, and it seems to be called about every second. But this is a nasty hack since the keyboard still shows for a split second and moves my layouts back and forth. My current test devices consist of the Motorola Photon Q 4G LTE with 4.1.2 and a Honeywell Dolphin 70e Black with 4.0.3
EditText provides this functionality with the flag textIsSelectable in EditText set to true. With this, the cursor will still be present, and you'll be able to select/copy/cut/paste, but SoftKeyboard will never show. Requires API 11 and above.
You can set it in your xml layout like this:
<EditText
...
android:textIsSelectable="true"/>
Or programmatically, like this:
EditText editText = (EditText) findViewById(R.id.editText);
editText.setTextIsSelectable(true);
For anyone using API 10 and below, hack is provided here :
https://stackoverflow.com/a/20173020/7550472
Edit your <activity> tag in your AndroidManifest.xml and add this attribute: android:windowSoftInputMode="stateAlwaysHidden" see http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
Just added that and remove all the other weird things you are doing to hide the soft keyboard.
P.S. You can also enable and disable this feature at runtime. getWindow().getAttributes().softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
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.
I have a layout with lots of different imagebuttons on it.
Application is developed in full-touch, so there should be no response to keyboard or keypad on all activities except one, where user can input his name.
Is there a way to achieve that?
I've checked on debug, keypress and keypad press result in onKeyDown event.
I've set it to return 'false' for all keys.
But, for some reason, android keeps selecting my imagebuttons when keypad is pressed.
And pressing Enter key result in View.onClick event.
How to totally disable all keyboard input for activity?
I use Motorola Milestone for tests - a slider with a keyboard
Thanks
Try using the android:windowSoftInputMode="stateAlwaysHidden" for the tag in
the Manifest.xml file.
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft