I'm developing a HTML5 chat application, and I need to scroll down the message's area each time the keyboard is open. For that I'm listenig to the focus event on the textbox input.
But, in Android you can hide the keyboard without losing focus by pressing the arrow down button next to the home button (at least in 4.2), if you press again in the textbox input it will re-open the keyboard without triggering the "focus" event.
Is there any workaround to this?
Thanks.
Related
We are doing ionic2 application to scan the barcode and take the user to detail of that product. The screen has input field with Opacity 0 since the input should not be visible to user to prevent user interaction. Right now the functionality works fine but the keyboard opens by default when ever user visits this screen.
I tried to user below code to hide the keyboard but this looks odd as the keyboard visible for fraction of time and then hidden;
cordova.plugins.Keyboard.close();
I want to focus the input without keyboard open, is it possible ? could you please guide me
After al long research found that there is no solution to focus the input without keyboard. Hence i changed the approach and create the broadcast receiver to handle the barcode scan.
I am new in appcelerator. I have an issue. I need to call an event when android soft keyboard disappeared by clicking android back button(hardware back button). I can call event when we pressed done/enter button in soft keyboard. But i need to call the event when soft keyboard disappear(by clicking hardware android back button).
Any help will be deeply appreciated. Thank you
You need to add a listener to keyboardFrameChanged, with a little of code you can control if the frame change was caused by the appearence or the disappearence of the keyboard.
I've made a custom soft keyboard extended from InputMethodService class, when the user clicks on any EditText, my keyboard will be shown and fill the whole screen (portrait or landscape).
Once I open Twitter application to write a tweet, writing Tweet screen shows up and my keyboard will be shown with no problems.
Once I click back button to hide the keyboard and back to write tweet screen, the keyboard and tweet screen have gone as well! So, any text I've written using my keyboard will be also gone.
I'm not sure if this is Twitter app problem, but I'm not sure how can I solve that? Even if I could handle back button event, what should I do next?
If you also using any soft keyboard, once you click back button, it will hide the keyboard and write a tweet screen as well.
I made a small trick for that, write a text and remove it to get the focus when onWindowShown is called:
getCurrentInputConnection().commitText(" ", 1);
getCurrentInputConnection().deleteSurroundingText(1, 0);
Now everything is working fine :)
I have implemented a note-taking UI where a WebView accepts user input and below it is a row of buttons that toggle formatting inside of the WebView. The buttons sit on the bottom of the layout, so when the soft-keyboard pops up when the WebView has focus the buttons sit just above the keyboard.
This is working great, but my problem is that whenever one of the buttons is pressed the soft-keyboard closes. I want to leave the soft-keyboard as it is whenever a button is pressed. So if it is closed, a button press won't open it, and if it is open then a button press won't close it.
I found the Wordpress Android source code, and the layout is extremely similar and it has the exact button-keyboard interaction I want.
The relevant sources on GitHub are here Activity Code and here Layout XML
I can't figure out how they do it though. They don't call the InputMethodManager, which I am trying to avoid if possible since it can cause jumpy behavior where the keyboard has to re-open itself whenever a button is pressed. The one similar question I found had answers that essentially said to do exactly that, or create a useless view to get the focus to prevent the keyboard from closing. Neither seem very efficient.
Most of the time (but not always), when I finish typing in a or and the soft keyboard hides, the view area is left raised with a black space on the bottom. Clicking, tilting or otherwise engaging the phone corrects the screen. However, user's first motion is usually pressing , but if you click submit it jumps down and you actually just click on the text area again. How do you stop this and get the screen to reset after the keyboard closes.
Take a look at you AndroidManifest.xml
http://developer.android.com/guide/topics/manifest/activity-element.html
I think you need to change android:configChanges.
I have the exact same problem what i did was handle hidekeyboard even in javascript and do something like window.scrollTo(0,0) or $("input[type=text],textarea").blur();
This will cause the the screen to get back to normal position
But there is just one problem when click from input field of type = text to a input field password it internally hide the keyboard which causes the hidekeyboard event to fire and scrolls the screen to top. This is the only side effect of this
Let me know if you find the solution for this