android-softkeyboard

How to catch a soft keyboard 'enter/done' press?

若如初见. 提交于 2019-12-05 02:05:30
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. 来源: https://stackoverflow.com/questions/5330243/how-to-catch-a-soft-keyboard-enter-done-press

Android app crashes when switching Fragment after showing a keyboard that is set with nextFocusDown

折月煮酒 提交于 2019-12-05 01:58:58
I have an app that was working nicely with multiple fragments that are switching based on a navigation bar interaction. One of the screens has multiple text fields, and I decided to order these fields so the keyboard "next" would automatically take the user to the next fillable text field by using nextFocusDown . The last one leads to RadioGroup which results in the "done" button being shown. The fields look like this (they are within LinearLayout that is within a NestedScrollView within another LinearLayout that is under the root FrameLayout ): <EditText android:id="@+id/firstName" android

Remove whole Spannable with backspace

喜欢而已 提交于 2019-12-05 01:27:53
I have a chat application which offers the possibility to add emoticons to the text. I have a problem with the EditText field. The emoticon images show up but if I press on the normal keyboard the backspace button, the text which I was changing to an emoticons picture shows up and I have to remove several characters until the picture goes away. I am using Spannable to do this. I want the whole smilie go away if the user presses one time backspace. Here the code I am using: // This is in the keyclicked listener { ... smilie = "(angel)"; break; ... int cursorPosition = content.getSelectionStart(

Android: How to make button on candidate view in softkeyboard?

此生再无相见时 提交于 2019-12-05 01:16:03
问题 I want to make candidateView inside button but you see log cat: please share code My Code SoftKeyboard.java @Override public View onCreateCandidatesView() { LayoutInflater li = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View wordBar = li.inflate(R.layout.wordbar, null); LinearLayout ll = (LinearLayout) wordBar.findViewById(R.id.words); Button btn = (Button) wordBar.findViewById(R.id.button1); btn.setOnClickListener(this); mCandidateView = new

How to NOT close keyboard when DONE on keyboard is pressed

断了今生、忘了曾经 提交于 2019-12-04 23:10:15
When the user presses "Done" on the soft keyboard, the keyboard closes. I want it so that it will only close if a certain condition is true (eg. the password was entered correctly). This is my code (sets up a listener for when the "Done" button is pressed): final EditText et = (EditText)findViewById(R.id.et); et.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if(actionId==EditorInfo.IME_ACTION_DONE) { if (et.getText().toString().equals(password)) // they entered correct { // log them in } else { //

Hiding ‘Bottom Navigation Bar’ whilst keyboard is present - Android

浪尽此生 提交于 2019-12-04 22:51:49
I have a small demo chat UI application. This application has a bottom navigation bar. I need the bottom navigation bar to hide when the keyboard appears. Here is an example of the chat UI As you can see when you click in the EditText element, the keyboard appears but the bottom navigation bar stays visible. I have tried methods such as this measurement method , but the UI elements flicker like this . Is there a proper way to hide the bottom navigation bar when the keyboard is visible? EDIT: In the below activity you can see where I set the keyboard listener to adjust the position of UI

how to hide virtual keyboard on touch of a spinner

陌路散爱 提交于 2019-12-04 22:48:18
I have a edittext and a spinner. When I touch on the edittext the keyboard appears, after completed the text editing I touch on the dropdown arrow of the spinner but the keyboard doesn't disappears automatically. Please give me some solution. I tried this code InputMethodManager imm=(InputMethodManager)getApplicationContext().getSystemService(SetUpProfileActivity.this.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mDateOfBirth.getWindowToken(), 0); This is the xml <LinearLayout android:id="@+id/outerlayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android

Android Soft Keyboard: How to manipulate views on keyboard on/off

风流意气都作罢 提交于 2019-12-04 21:38:15
I have a layout which has one large EditText view at the top + a bunch of buttons at the bottom. The EditText is made to shrink and expand when the ime is activated/deactivated by using adjust_resize. The buttons at the bottom are pushed up above the ime. I would like to hide these buttons when the ime displays, to provide enough space for the EditText view. I have so far tried the following: subclassed EditText and provided the activity the option to register a callback on the view's OnSizeChanged. Used this callback to change the visibility of the buttons (actually the layout container) to

Soft keyboard push up hidding action bar or overlay edittext

纵然是瞬间 提交于 2019-12-04 19:44:55
I have an issue with a simple layout. If I set android:windowSoftInputMode="stateHidden|adjustResize" this happens: Bug In any case this happens only If I open keyboard from landscape, then rotate (with keyboard open). In normal use (rotating and then opening keyboard) this does not happens! If I set android:windowSoftInputMode="stateHidden|adjustPan" ActionBar is pushed up. Here layout code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/a" android:layout

How to display the Soft Keyboard from a Service?

我只是一个虾纸丫 提交于 2019-12-04 19:07:56
问题 Short question: Is it possible (and how) to display the soft-keyboard from a Service? Long question: I wrote a service which creates a "top bar", displayed on top of all activities, containing an EditText. I want to display the soft-keyboard when that EditText is clicked, but this is not happening. Of course I've tried this from the Service's onFocusChange() and onClick(): InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE); imm.showSoftInput