In Android if we press ?123 key (or similar) on software keyboard it shows us digits/symbols layout. And it will automatically turns back to alphabetical layout when whitespace pressed or EditText cleared by app from code.
Is there any option to turn off this "auto reset" behavior? Maybe some flag for EditText, InputConnection, InputType, etc.
Note that numeric keyboard is not suitable. It must be common keyboard (InputType.TYPE_CLASS_TEXT) which just allows only manual switching between layouts.
Related
I have a custom android keyboard. On long press popup keyboard is shown how it should. The problem is, when it pops up, the keyboard behind is darkenes.
How can i disable this, except overriding the default KeyboardView onDraw?
One more thing: how can I make the poped up keyboard buttons selected without pressing on them? In Google keyboard, when you press on a "." key, you just keep moving your finger and it selects the key on the popup. But on the default implementation of KeyboardView, you have to press on the key.
This has been bugging me for a month, hope you can help!
Solution: don't use KeyboardView. Its meant for quick prototyping, when you need a basic keyboard and are working on other things like autocorrect algorithms. No serious keyboard actually uses it, and it isn't required (you can return any view from onCreateInputView). As you ramp up UI complexity, it just quickly becomes unable to deal
I'm trying to make my android app backwards compatible, from targetSDK=21 to minSDK=19. My app has webviews. When an input field in the webview is focused, the keyboard comes up, but nothing is displayed but the background color in place of the keyboard. But something is definitely there; when I press the space where the keyboard should be, keys are being pressed (ie. letters get entered into the input field), but I just can't see them. Also, the keyboard space covers up the webview so I know that something is there. Any ideas on what's going on?
EDIT: Here's a link to a screenshot. The bottom grayish area is where the invisible keyboard is. If I press on this area, keys do get pressed but the actual keyboard is not visible.
https://www.dropbox.com/s/4pbfj6gey2h6dyc/Screenshot_2015-09-17-12-50-22.png?dl=0
I would like to remove the navigation buttons at the bottom of the soft keyboard ( the buttons with the arrow- they act like a tab key to move between fields). I have had no luck trying to find a way to do this. Does anyone have any suggestions
What you're describing is device-specific, as each device has its own default soft keyboard. Unfortunately, you'll need to make a custom keyboard.
Look at the Keyboard class.
I don't believe it's possible to remove the button from the keyboard, but you can at least specify which neighbor the field gives focus to. See Handling UI Events on the Android Dev Guide.
Perhaps it's possible to set nextFocusDown to nothing, so the keyboard doesn't let the user navigate in that fashion. If that doesn't work, you might consider setting the field that takes focus next to setFocusable(false).
I have a common EditText. It's very strange because I can't focus it when use hard keyboard. Context condition:
switch Droid's hardkeyboard on
start the activity
click the editText to input
Fail to input. When you press any key, the editText lost focus.
To get focus:
press Dpad and you will see the focus starts from the 1st widget in the screen. And finally focus on the target EditText. Then you can input. Without this, you can't input with hard keyboard at all.
Soft keyboard doesn't have such focus problem.
I am using android 2.2. Is this a system bug?
As mentioned above this is clearly a bug with hard keyboard. If you have an EditText and a TabHost in your layout, on first key pressed, EditText lose focus and key press is sent to the activity instead. Here is a work around to this problem. Implement this in your activity.
#Override
public boolean onKeyDown(int keyCode, KeyEvent event){
final EditText myInputField = (EditText) findViewById(R.id.MyInputEditText);
// this will happen on first key pressed on hard-keyboard only. Once myInputField
// gets the focus again, it will automatically receive further key presses.
if (!myInputField.hasFocus()){
myInputField.requestFocus();
myInputField.onKeyDown(keyCode, event);
}
return super.onKeyDown(keyCode, event);
}
if you have multiple EditText fields, you will need to keep track of currently focused EditText in a class variable and use it in onKeyDown method.
I have the same problem. I kinda agree with Jay. Typically TabHost, and/or TabActivity utilize a LocalActivityManager that keeps track of embedded Activities or appropriate ContentStrategy component that is displayed within the FrameLayout element. In simple words, this is a typical embedded Activities/ embedded Views layout problem. The Edit Text is on the top-most Activity/View that is taking the touch-screen space, while there's a core Activity that is actually hosting this Activity/View that probably is grabbing the InputMethodService focus and keeping it away from the Edit Text, only for the hard-keyboard scenario. The soft-keyboard just works fine.
One change I did to my Edit Text is to change the InputType as purely decimal. So when the Edit Text gains focus, the soft keyboard shows a numeric key-pad and not the alphabetical qwerty key-pad. I ran it on a Motorla Droid Pro emulator, that I updated in Eclipse Plugins from the Motodev website. Apparently, when I try to enter text from the hard keyboard after having given focus for the Edit Text (and the soft-keyboard is showing a numeric key-pad), after I click 'ALT + 2', the soft-keyboard is reloaded as alphabetic key-pad while the Edit Text loses focus entirely.
Seems like a serious bug to me in the Froyo release, insufficient support for hard-keyboard devices for edit text views in layouts (LinearLayout) that are embedded in other layouts (FrameLayout of a TabHost).
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