Keep virtual keyboard open even if no text is selected - android

When creating an Android virtual keyboard, is it possible to have the keyboard stay open even if no text is selected?
If not, is it possible to occupy the area where the keyboard is when it's open, so that the layouts of the opened app don't change?
Reason being that I am working on a physical keyboard attachment, and I am considering making something similar to the Samsung S8 keyboard attachment (https://eskerahn.dk/?p=2284).
I could easily make something that works with the visible virtual keyboard, but as soon as the virtual keyboard closes, the app would use the full screen and then part of the app would be behind the keyboard.
If there is a solution, it should be compatible with Android 11 and 12 (so sadly no wm overscan).

Related

Soft keyboard not popping up when edit text has focus on Genymotion device

In my application there is a search segment -- just like on the twitter app. When the user clicks the magnifying glass the search segment starts (a fragment) and the keyboard is suppose to pop up so the user can type the query into the search bar.
What actually happens is the cursor is blinking in the search bar, and I can type into the bar with the hard keyboard, but the soft keyboard doesn't pop up. If I click the search bar, then the soft keyboard pops up.
Any ideas why the soft keyboard isn't popping up when the cursor is blinking in the search bar?
Apparently the soft keyboard isn't enabled by default on Genymotion.
I've turned on the soft keyboard by going to Settings | Language & Input | Current Keyboard and turning on the Show Input Method switch. But I have had some difficulty with this.
Different API versions have different UIs for this setting and it's never quite clear how to get the soft keys to show. Sometimes I've set the soft keys to show and they still don't show. Maybe you have to set them then restart Android on the device.
But that's where the setting is, and if your experience is anything like mine, you'll get it soft keys to show after you jank around with it for awhile.
You must enable it from the Genymotion application:
Open Genymotion app, it will display the list of your Genymotion devices
On the device you want to use the virtual keyboard click on the setting icon
Then check the option "Use virtual keyboard for text input"
You will then have a virtual keyboard poping up when you click on an edit text.
This will work whatever the Android version of your device is.

Android Fix Floating Numeric Keyboard

I initially started making an application on a Samsung Tab 3, and recently changed to a Samsung Active tablet. Since making the change, I noticed that the numeric keyboard is detached from the bottom of the screen, and is movable. I really want the numeric keyboard to be locked to the bottom of the screen, just like the regular keyboard.
Does anyone know how to fix this?
Note: I'm running version 4.4.4

Android physical keyboard still makes virtual keyboard show

I'm working on a project where I use an 'Android Mini PC' (chinese) and connect it to the TV. The user uses their remote to navigate through the environment.
The application is fullscreen, but whenever a dialog is launched, the virtual keyboard pops up with the navigation bar, which needs to be hidden at all times. (even though I'm testing with a physical keyboard) I didn't have this problem with an older model of the Android Mini PC.
I can force the virtual keyboard off by disabling the service, but I just need it to remain hidden when a physical keyboard is present, not the entire time. (worked fine on the older model, which fried itself, thus I'm using a new model)
The second problem is the navigation bar. Even though the service is disabled, the navigation bar still shows up when the keyboard would be launched. For the project I'm working on, it's crucial the navigation bar stays of the screen. I fear the Mini PC thinks it's a tablet, which makes it harder (if not impossible) to keep the navigation bar hidden at all times.

Why does the Soft Keyboard appear?

I'm using the Android emulator to test my first Android application. While there is a functioning hard keyboard at the right side of the emulator window, the soft keyboard shows up when editing in an EditText control.
I'm aware of the option to hide the soft keyboard by using an instance of InputMethodManager, however I'm wondering why the soft keyboard does appear at all (when the hard keyboard is available).
To me, as a user, the soft keyboard in this case is rather distracting, hence I'd like to get rid of it if useful. - This question is about the practical context (i.e., is there any use of the soft keyboard when there is a hard keyboard, do real-world devices behave similarly to the emulator) and about general strategies to address the issue.
Thanks. I'll be upvoting any helpful hints.
On my G1, when the hard keyboard was opened, the soft keyboard didn't appear. But I'm not sure whether a device which ALWAYS has a keyboard opened (like the Samsung Galaxy PRO if I'm not mistaken) does the same.
Since the emulator doesn't have a slide keyboard, I think that's the case for this behavior.
With a touch screen device + hard keyboard you have the flexibility to use both. On most devices with hard keyboards the keyboard has to be dragged out. It's much easier to just tap the screen. If you want to type a lot you would take the trouble to slide the keyboard out.
Android gives you the flexibility to program for all these behaviors.
Actually, the AVD emulator does have a slide-out keyboard.
The AVD option "Keyboard support" indicates whether the emulated device has any form of physical keyboard. The option "Keyboard lid support" indicates whether the device has a keyboard that can be opened or closed (slid out or what have you).
As far as actually "opening" and "closing" the keyboard on a device set up with these options,
you need to switch the orientation which is generally what you do with real-world slide-out-keyboard phones, e.g. the original Droid:
Original Droid with slide-out keyboard open
In the emulator, you control this orientation change with Ctrl+F11/Ctrl+F12 or 7/9 (on the number pad only, with NumLk off).
You can confirm the keyboard opening and closing states by checking the value getResources().getConfiguration().hardKeyboardHidden == config.HARDKEYBOARDHIDDEN_YES
As far as whether the soft keyboard appears or not, it appears to me that handling such things is up to you as the programmer. Here's an example you can try in AVD:
Set up an emulator with "Keyboard support" and "Keyboard lid support" both set to yes.
Launch the emulator, then open Android's built in Messaging app.
Click in one of the text boxes - the soft keyboard should show up.
Switch the orientation of the emulator with Ctrl+F12 - the soft keyboard should now disappear
Note there seems to be a problem with the emulator itself, that switching back to portrait mode doesn't cause apps to redraw themselves back to portrait layout. but they will switch back to closed keyboard mode, which yields some odd, sideways-y behavior.
For an example of code to catch the keyboard opening/closing events, check out: http://www.how-to-develop-android-apps.com/how-to-detect-screen-orientation-change-in-android/
After testing on real world devices; On the motorola milestone that has a sliding keyboard that if it's open the soft keyboard is not shown, but when it's closed the soft keyboard is shown. On the HTC Cha-Cha, that has a permanently shown keyboard, the phone always uses the hardware keyboard. Even when in landscape and the hard keyboard would be very difficult to use it doesn't show a soft keyboard (Even after installing a soft keyboard I was unable to select it for use under Keyboard & Language Settings).
For additional information about the phone you can use the following.They will return the keyboard type and whether or not it is a hard keyboard and shown. Note: Phones without a hard keyboard that I've tested report that hardKeyboardHidden=2; (Which indicates hidden=yes), but type reports as soft keyboard which makes sense.
Configuration config = getContext().getResources().getConfiguration();
int keyboardHidden=config.hardKeyboardHidden;
int keyboard=config.keyboard;
http://developer.android.com/reference/android/content/res/Configuration.html#HARDKEYBOARDHIDDEN_NO

can one prevent the Android device emulator from popping up the onscreen keyboard?

I am developing an Android application. What I find most annoying during testing is, that the emulator always pops up that on-screen telephone keyboard whenever I click into a text input field. Since I input my data with the keyboard anyway I find that most annoying. Can one switch that on-screen keyboard appearance off? Or can one change that so that it at least presents a mini-qwerty keyboard as my actual device does, not that old-fashioned T9 keyboard?
Michael
You can disable the virtual keyboard in Settings->Language.
If you change orientation of the emulator it won't popup (KEYPAD_7, Ctrl-F11).
If you use cursor keys instead of clicking the fields, probably won't popup either.
Whatever you do, keep in mind that in actual devices it usually pops up anyway.

Categories

Resources