android-softkeyboard

Implementing onKeyPreIme(int keyCode, KeyEvent event) in Fragment

ぃ、小莉子 提交于 2019-11-27 12:28:23
问题 I cannot figure how to implement onKeyPreIme(int keyCode, KeyEvent event) in a Fragment . @Override public boolean onKeyPreIme(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { // do your stuff return false; } return super.dispatchKeyEvent(event); } I tried a lot but nothing works. Also, I could not find anything on Google or Stack Overflow. I would like to perform an action when the back key is pressed and the softkeyboard is up

WebView hides soft keyboard during loadUrl(), which means a keyboard cannot stay open while calling javascript

淺唱寂寞╮ 提交于 2019-11-27 12:25:29
问题 Since the way you call javascript on a WebView is through loadUrl("javascript: ... "); The keyboard cannot stay open. The loadUrl() method calls loadUrlImpl() , which calls a method called clearHelpers() which then calls clearTextEntry(), which then calls hideSoftKeyboard() and then we become oh so lonely as the keyboard goes away. As far as I can see all of those are private and cannot be overridden. Has anyone found a workaround for this? Is there a way to force the keyboard to stay open or

Push Listview when keyboard appears without adjustPan

空扰寡人 提交于 2019-11-27 11:54:57
I am trying to create an activity with a listview and a send message at bottom. The problem is that when the keyboard is shown, instead of pushing the bottom content, is just hiding it. I tried using adjustPan, but it pushes the hole view up (so there is no way to see the top elements of the listview and also de actionbar disappears). If you take a look at WhatsApp or Line, the functionality is that when the last item of the list is shown at the bottom of the screen, the keyboard pushes up the listview (without taking the action bar or the first elements out of the screen), and when the last

Android custom keyboard popup keyboard on long press

丶灬走出姿态 提交于 2019-11-27 11:17:31
问题 I have custom Android keyboard: public class CustomKeyboard extends Keyboard{...} public class CustomKeyboardView extends KeyboardView{...} public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...} On some keys, I have popupKeyboard and popupCharacters : <Key android:codes="144" android:keyLabel="0" android:popupKeyboard="@xml/key_popup" android:popupCharacters=")" android:keyEdgeFlags="right"/> xml/key_popup.xml: <Keyboard xmlns:android=

when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop

元气小坏坏 提交于 2019-11-27 10:58:56
I am using AlertDialog.Builder in order to create an input box, with EditText as the input method. Unfortunately, the Soft Keyboard doesn't pop, although the EditText is in focus, unless you explicitly touch it again. Is there a way to force it to pop? I've tried the following, after the (AlertDialog.Builder).show(); but for no avail. InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(input, InputMethodManager.SHOW_FORCED); Anyone can help? Thanks!! grine4ka I've made such a thing AlertDialog.Builder b = new AlertDialog.Builder(this)

Android Use Done button on Keyboard to click button

天涯浪子 提交于 2019-11-27 10:32:42
Ok in my app I have a field for the user to input a number. I have the field set to only accept numbers. When the user clicks on the field it brings up the keyboard. On the keyboard (on ICS) there is a done button. I would like for the done button on the keyboard to trigger the submit button i have in my application. My code is as follows. package com.michaelpeerman.probability; import android.app.Activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.os.Bundle; import android.os.Handler;

hide keyboard when user taps anywhere else on the screen in android

我的梦境 提交于 2019-11-27 10:00:39
问题 I need to hide the softkeypad in android when user click on anywhere other than a Edittext. There are many help for iphone but not for android. I tried this code but its not working :( final RelativeLayout base = (RelativeLayout) findViewById(R.id.RelativeLayout1); findViewById(R.id.base).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow

android: Softkeyboard perform action when Done key is pressed

自闭症网瘾萝莉.ら 提交于 2019-11-27 09:45:27
问题 I have an EditText. I want that after typing some text, when user presses the Done key of the softkeyboard, it should directly perform some search operation which I have also implemented in a button click event. 回答1: Try this editText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if(actionId==EditorInfo.IME_ACTION_DONE){ //do something } return false; } }); 回答2: Try this It works both for DONE and

Disable soft keyboard on NumberPicker

ぐ巨炮叔叔 提交于 2019-11-27 09:10:02
问题 I'm trying to deactivate the soft keyboard when using a NumberPicker to enter numerical values (for aesthetic reasons). This is my layout-xml-code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android

Get the height of virtual keyboard in Android

泪湿孤枕 提交于 2019-11-27 08:40:07
How can I get the height of virtual keyboard in Android? Is it possible? I try to get it from the main window, but it gives me full height of the application. But I want to get the keyboard height. You can't get the keyboard height, but you can get the height of your View, which is what you really want - and you'll get this data supplied to the onLayout call into the current view. you can use this sample code. it is dirty solution but it works Thread t = new Thread(){ public void run() { int y = mainScreenView.getHeight()-2; int x = 10; int counter = 0; int height = y; while (true){ final