is there any way to define how far a view is moved up when the soft keyboard appears? In my case i have a Username and a Password EditText close to the bottom of my view, when the user now clicks on the Username field the soft keyboard appears and the View is automatically moved up so that you can see the Username EditText. But then the user is not able to see the Password EditText, which is kindof counter-intuitive. When the user once klicked on the Password Field and then goes back to the Username Field everything looks like i want it to look.
Im am using Android 2.3.3 API Level 10
I did add
android:windowSoftInputMode="adjustPan"
in my activity since i don't want the view to resize when the keyboard appears.
without keyboard:
with keyboard and Username focus:
after click on password - also desired behaviour after click on Username:
Related
what I mean by the title is by pressing enter from the keyboard instead of pressing a button.
I want the user to have another option of confirming the password from the keyboard
Edit:grammar fixed
I wrapped my form in a <ScrollView> and I set my manifest android:windowSoftInputMode="adjustResize" (default of react native). Now when I manually focus a field with my finger touch event, and the field is covered by keyboard, it successfully scrolls to the field I just pressed.
However, if I pragmatically focus the next field (refToTextInput.focus()), it is not scrolling to that next field (focus does happen). I need the scroll to happen.
How can I trigger the adjustResize again, so it scrolls into view the next field I focused?
Manual focus - good
Here is what happens on manual focusing the password field, screencast:
Programmatic focus - bad - fail
However if my focus is in the "username" field and then I do this.refToPassword.focus() on the onSubmitEditing of the username field. Focus moves to the password input, and the keyboard doesnt flash (this is perfect I don't want the keyboard to flash). HOWEVER, the scroll view doesn't scroll to this field. Here is screencast of programmatic focus:
This is not the exact solution that I am proposing. However, you might consider this as a workaround.
You might consider hiding the keyboard programatically and showing the keyboard again on requesting focus programatically in the next EditText field. So the complete pseudo code for requesting the focus in next field will be something like.
public void requestFocusToNextField(View view) {
view.requestFocus();
hideKeyboard();
showKeyboard();
}
Hope that helps!
I have an application where user needs to input some text. When I click the editText area a keyboard appears and then I input the text after which I have to press the "back" key on my phone to hide the keyboard and then press the submit button which is getting annoying.
How do I get that "ok" button that does it for me which I am used to? I have Android version 2.3.6 on my phone. Is this even available at this API level ?
Use onEditorActionListener http://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html on your EditText.
Also see: EditorInfo http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
I would like to know when the user presses the 'enter/done/next' key on the soft keyboard without the activity knowing which edittext box the user is in. I have seen some code, but it always uses the name of the edittext box that is being edited.
The app has numerous edittext boxes, and calculations are re-run anytime any one of the values in a edittext box is changed.
Then attach the OnEditorActionListener to all of them.
Is there any way out for mapping the Done button to the button on the screen in Android. What I want is that I have one login screen user enters username and presses the next button on the soft keyboard which brings the focus on password field. AFter entering password when the user presses done button then the action which is performed on login button should be called.
Let me know if this is possible.
In your layout file, you can specify the focus order using attributes like nextFocusDown. If you have the focus order configured properly, hitting next should automatically take you to the next focusable element.
You can also add a KeyListener to the edit text to listen for the next key and set the focus accordingly.