I have an EditText and an ImageButton beside it. When I click the EditText the soft keyboard shows up. Fine. When I click the ImageButton a custom dialog shows up and the soft keyboard gets automatically hidden. I want the keyboard to stay open though. How can I achieve this?
Found the solution. I used the common Dialog class to display my dialog. Using AlertDialog instead did the trick.
Related
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 am trying to show dialog when user touch on edit text. The problem is when I show the dialog, the keyboard is disappear. How to solve this problem? I think this is because when show dialog, the activity loose focus. There is a similar question in SO. When Dialog is showing, outside edittext in activity not showing the soft keyboard in android. But that answer does not work for me. I am using custom dialog which extends android Dialog classs.
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
I know this should not be a big challenge but it really drives me insane.
I am developing a simple soft keyboard input method and basically I have added a button to my softkeyboard, by pressing which, a dialog should pop up to prompt user to do some choices.
By far everything is ok about creating and opening the dialog. Since normally a dialog is created and displayed from outside an activity, so a flick solution could be to create a transparent activity which embedded the dialog in it. By doing so, I could easily start a dialog when user click the button on my softkeyboard.
But one tricky problem is: every time user click the button and the dialog (actually a dialog in a transparent activity) displays, it will always make my softkeyboard hide. I just need to start the dialog without any changes to the status of my softkeyboard -- I want my softkeyboard keeps showing when the dialog starts.
Here is a snapshot of Google Keyboard, it has the similar button which display a dialog and the dialog did not hide the keyboard, this is exactly what I want. So please anyone suggest me how to achieve this. Thanks so much.
THey aren't launching an Activity. They're launching a dialog. Which is tricky from an input method because its a service (you have to specify the dialog's window token to make it show) but doable.
How to make EditText shows like Instagram after soft keyboard comes out when I click the EditText?It just like being pushed up.Not like google+ or other apps,these are like appearping after disappearing.
I tried "windowSoftInputMode="adjustPan" ,and if the EditText is not having background it's good.But if the EditText has some background,the soft keyboard will cover some part of the editText.
hide keyboard
Try this..
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
I have this issue: in my app, when user taps on EditText bar, keyboard pops up. After that, it is impossible to get rid of keyboard. When back button is pressed, whole application just turn off.
How can I make sure, that when user taps on some other object (not EditText), keyboard will be removed? Or at least, how to make it possible to hide keyboard by tapping back button?
Thanks.
in xml for EditText this will make keyboard dismiss when press enter on keyboard
android:imeOptions="actionDone"
You can hide the keyboard simple by overriding onBackPressed in your Activity and using the following code:
InputMethodManager inputMethodManager = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(anyView.getWindowToken(), 0);
Note that anyView can be any view that is attached to your current window.
You can see it working in my app called Magic Annotator. See method hideSoftKeyboard()