android-softkeyboard

Hide keyboard when navigating from a fragment to another

北战南征 提交于 2019-12-20 08:48:14
问题 I have a Fragment that contains an Edit Text. When the Edit Text is pressed, the keyboard is being shown. When pressed the Save button in the upper corner, the application returns to the previous fragment, but the keyboard persists. I would like the keyboard to be hidden when navigating to the previous fragment. Please, note that I tried this solution: Close/hide the Android Soft Keyboard. InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE

Close/hide the Android Soft Keyboard with Kotlin

自作多情 提交于 2019-12-20 08:47:46
问题 I'm trying to write a simple Android app in Kotlin. I have an EditText and a Button in my layout. After writing in the edit field and clicking on the Button, I want to hide the virtual keyboard. There is a popular question Close/hide the Android Soft Keyboard about doing it in Java, but as far as I understand, there should be an alternative version for Kotlin. How should I do it? 回答1: I think we can improve Viktor's answer a little. Based on it's always attached to a view, there will be

Show/Hide Soft Keyboard event in Fragment

为君一笑 提交于 2019-12-20 02:54:19
问题 There are a lot of posts about finding a show/hide soft keyboard event. I find myself in a situation where I need to change an icon based on the soft key status, in a fragment. I tried to implement onMeasure, but I can't override that in my fragment. Is there a (relative) painless way of getting a clean show/hide soft keyboard event in my fragment or should I abondon ship? 回答1: Sadly but true - android do not have native on software keyboard show event. One the way handle fact that keyboard

Android Pie edittext does not adjustPan/resize while typing

大憨熊 提交于 2019-12-19 21:49:22
问题 On Android PIE I have an Activity with several Edittext views inside a linear layout, and using SOFT_INPUT_ADJUST_PAN. While I am typing with soft keyboard on an Edittext the text is not displayed. If I type text on an Edittext near the top of the screen, where no PAN is necessary to keep the Edittext visible when the soft keyboard is displayed, everything works normally. If I type text on an Edittext near the bottom of the screen, where PAN is made to keep the Edittext visible when the soft

Detect input from software or hardware keyboard

戏子无情 提交于 2019-12-19 12:01:08
问题 I'm working in an Android app that must use a RFID tag reader. I'm using this reader as an extra device connected in my microUSB with an OTG wire. Android is detecting this device as an input keyboard. I would like to know if I can programatically detect when a user does an input with this reader. So basically I must differenciate the input from my softkeyboard or this reader. I searched a lot but I can't find a solution any help would be so appreciated. Thank you very much. 回答1: yourEditText

How to hide keyboard when user clicks on textbox in webview android

拥有回忆 提交于 2019-12-19 08:15:14
问题 Can we hide android system keyboard when user focuses or clicks on html input elements inside the webview. I have tried hiding keyboard on user touches webview: webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch (View v, MotionEvent event){ Toast.makeText(cx,"Web View Touch",Toast.LENGTH_LONG).show(); v.onTouchEvent(event); InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm

I can't write into the EditText, it disappears when i try to write something, its because the getView() is called when i modify the data

南楼画角 提交于 2019-12-19 07:36:15
问题 EDIT: I found the reason which is that the getView() is called when i try to edit something, so the data from the DataAdapter is loaded & my edited changes disappears. EDIT: i observed one thing, if there are few rows in the listview then its OK, but if there are many rows which the listview can not show in the visible screen (Scroll bar appears to scroll to other records), then the issue arises!! I am working on project where we have implemented an INLINE EDITING using ListView, i.e. the

How to change color of keys in KeyboardView Class in custom Android keyboard? [duplicate]

六眼飞鱼酱① 提交于 2019-12-18 17:25:34
问题 This question already has answers here : How to change background color of key for android soft keyboard? (2 answers) How to change background color or theme of keys dynamically in Custom Keyboard Android (2 answers) Closed 6 years ago . I am working on a Custom Keyboard App. I need to set different themes for keys or background color in KeyboardView class and get key color at onCreateInputView() in SoftKeyboard extends InputMethodService Class. However I am not getting how to get particular

Why doesn't android:windowSoftInputMode=“stateVisible|adjustResize” adjust the screen when soft keyboard is shown?

混江龙づ霸主 提交于 2019-12-18 17:04:36
问题 I can't seem to make the android:windowSoftInputMode="stateVisible|adjustResize" option work. When the soft keyboard shows, the scroll view doesn't automatically scroll to the bottom part. Edit : I tried using adjustPan instead (stateVisible|adjustPan) but what happens is the scroll view gets disabled. Solution : Finally, I found a suggestion that works. I created an OnGlobalLayoutListener() and added it to my scroll view. I checked if the height of the root view of my activity(which is my

html phonegap android : numeric soft keyboard has next instead of go button

廉价感情. 提交于 2019-12-18 14:54:35
问题 This is driving me crazy and I can't find the answer anywhere. I have forms in my phonegap app. If the input type="text", the text keyboard pops up and "go" is displayed in the corner. When you click go, it submits the form. That all works as I would expect. But if I use input type="number", the number keyboard pops up and "next" is displayed in the corner. When you click next, if there is another input box before the button tag, it goes to that input. That's okay. . . not ideal, but makes