The problem is that when I click the back button when introducing text in an EditText, suddenly the Home Up button gets selected in a darker color.
I've disabled the Home Up button and it continues happening. What can I do?
Well, I've made some improvements forcing to focus on an element on my layout. But the up navigation button keeps getting the focus after the EditText. The action happens like this:
I hide the EditText that has the focus
The up navigation button (Android robot) gets the focus
My layout element gets the focus
How can I solve that?
Finally solved!
It was a problem of the keyboard of the emulator =S
I had the option to get input from my laptop keyboard, I've disabled it and now it works
Thanks to g00dy for the help =)
Related
I'm writing a custom EditText that will have functionalities to bold/italic/underline/lists .... for Android
It's working so far so good but I've a problem that when a user clicking on a Button (for styling bold/italic...), the user will lose focus on the EditText.
Anyone has any ideas how to prevent the button taking focus from the EditText?
Thanks :)
The easiest thing to do would be to have the onClickListener of those buttons refocus the edit text as their last instruction.
You can also try putting focusable=false (and focusableInTouchMode=false) on the buttons. That may work, I'm not sure if focus is removed from the edit text when the screen is touched or when another item receives focus, which is subtly but important difference here. It would also slightly change any drawables on the button that use focused state.
I am trying to scroll so that the two editText views and the button are all shown when the keyboard opens up. I have already tried adding softInputMode to the xml (I set it to adjustResize). I am now completely lost on how to do this. Anyone have any ideas?
Before the Keyboard shows up
When the keyboard opens
What I want it to look like
Thank you in advance!
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