In my application, I have a search button which when clicked will make an EditText widget visible, put focus in it, and show the keyboard. When I do this I call this code:
queryTextView.requestFocus();
InputMethodManager imm = Utilities.getInputMethodManagerFromContext(getContext());
imm.showSoftInput(queryTextView, InputMethodManager.SHOW_FORCED);
The first time this shows as I expect it to in landscape:
Once I enter text and hit search, I will hide my EditText and force the keyboard closed. I do this using this code:
InputMethodManager imm = Utilities.getInputMethodManagerFromContext(getContext());
imm.hideSoftInputFromWindow(getWindowToken(), 0);
If I were to hit my button again to make the EdidText visible and show the keyboard again, my screen looks like this (only when using the stock Galaxy Nexus keyboard):
Using another keyboard, such as SwiftKey, I do not get this behavior. What kinds of things can I look for to find out why this soft-keyboard is not filling the screen fully?
EDIT: on second thought, from your screenshots it looks like the keyboard is trying to take up the full screen, so onEvaluateFullscreenMode should be returning true...perhaps the problem is somewhere in onCreateExtractTextView
Not what you're looking for, but if all else fails perhaps you could grap the AOSP keyboard source, walk through it and figure out if/why onEvaluateFullscreenMode is returning, or maybe it isn't being called at all.
Use android:imeOptions="flagNoFullscreen" to achieve that feature.
Related
I have activated the TalkBack (Accessibility). And I'm navigating for a Screen that is displayed a keyboard in order to write a number in my app.
When I swipe from the left to the right in order to hear all items available the announcement read all my UI components but never jump to the KeyBoard Buttons. So the users will ever know there is a keyboard displayed in the UI.
I have tested on iOS and the VoiceOver is reading the Keyboard properly but seems like Android have an issue.
Does anyone know if there is a way to activate the Keyboard Voice Feedback programmatically?
I'm using this code to show the keyboard.
InputMethodManager input = (InputMethodManager)
activity.getSystemService(Context.INPUT_METHOD_SERVICE);
input.showSoftInput(activity.getCurrentFocus(), InputMethodManager
.SHOW_IMPLICIT);
The keyboard is a separate app in Android. It would need to implement accessibility itself.
I want to do the following.
User should be able to input one letter (only letter) from standard keyboard (hardware or software). If he is typing another letter, then the previous letter should be replaced with this one. So only the current letter should be displayed. User should be able to dismiss this dialog and get back to activity. And if he clicked "done" button in keyboard the activity should know what letter he entered.
So I thought about alert dialog and edit text with some extensions to display only current char. This is easy.
However, and this gets me mad already, although edit text is in focus the keyboard does not appear on the screen until edit text is clicked. Why is that so?
It should be, should it not?
I won't take something like the following for the answer, because I shouldn't have to do it manually. It should be automatic. Besides, I'm not sure how this would work with a hardware keyboard.
InputMethodManager imm = InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(YourEditText.getWindowToken(), 0);
I want to know why exactly the keyboard is not shown after edit text has focus?
And what should I do to get this functionality without manually enabling and disabling software keyboard.
Use this.
EditText yourEditText= (EditText) findViewById(R.id.yourEditText);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT);
For your information, see this related question: Why the soft keyboard shows or not when an activity starts?. You can read it as an alternative by enclosing your EditText into a ScrollView.
But it's not more satisfying than the well known workaround (manually enabling the software keyboard) because we don't understand why it works better in this case...
I've looked at several questions and come across several posts, but i'm not able to figure out how to do this.
The following picture shows you the basic layout :
I've created a custom numpad and put it up on the repo.
Currently, when the app opens, the edit text has the focus but and anything i enter with the keyboard will go into the edittext box. This part of the functionality works fine.
Problem: When i touch the edittext again, system Input Method with its huge keyboard pops up. How do i completely block it from popping up? Or, can i tell the app to use only my keyboard instead of the system one? (Or is the only way to write a custom ime?)
i cannot use NULL type input at the manifest because doing that makes the caret in the edittext disappear and moreover if there are two edit texts, i wouldnt know which has focus.
Any help would be highly appreciated!
You can do a few things:
Programmatically hide it in the whole app:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Hide it from the view it would be attached to:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0);
Set the input type of the EditText to 0:
EditText yourEditText=(EditText)findViewById(R.id.editTextConvertValue);
yourEditText.setInputType(0);
I have a problem with showing keyboard in landscape mode. My activity contains an EditText where user must type a license number, and a Button ok. It looks like this (image is rotated)
. I put the following code to appear the keyboard when activity starts :
imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
imm.showSoftInput(this.licenseText,InputMethodManager.SHOW_FORCED);
and now my activity starts like this (image is rotated) :
My question is : why it looks like this? If it is in portrait mode, the keyboard appear on the bottom side but not affect the contain of current view. I put the EditText on the top side for this, to appear the keyboard on bottom. Can anyone explain me why this looks like this or if i can change this?
Try setting android:imeOptions="actionDone|flagNoExtractUi".
This sounds like the same issue discussed in Unproportional keyboard on landscape layout Android
The answer which gave by #Frank was right but you can do programmatically by this:
editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
as mentioned above, the keyboard does not show up, although the EditText is focused (orange border) and the cursor is blinking.
When I click into text field, it opens up, however I want it to be open right when the activity starts.
I tried setting android:windowSoftInputMode="stateVisible" in the activity, I tried showSoftInput(yourTextBox, InputMethodManager.SHOW_IMPLICIT); and also requestFocus().
But no success...
What could be the problem?
Try something like this:
EditText myEditText = (EditText) findViewById(R.id.editPasswd);
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
.showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);
Are you testing on emulator? If you do, you should know that keyboard doesn't pop up on emulator :), but it does on a real device
Good luck,
Arkde
Another way to show the keyboard when the Activity is created is to add this code in your AndroidManifest file for the activity which you want to show the keyboard on starts :
<activity android:name=".UserLogin" android:windowSoftInputMode="stateAlwaysVisible"/>